diff --git a/lib/component/sort_group.dart b/lib/component/sort_group.dart index 548ca5997..08372435c 100644 --- a/lib/component/sort_group.dart +++ b/lib/component/sort_group.dart @@ -23,21 +23,21 @@ class _SortGroupState extends State { Widget build(BuildContext context) { return SegmentedButton( style: ButtonStyle(backgroundColor: - WidgetStateProperty.resolveWith((Set states) { - if (states.contains(WidgetState.disabled)) { + MaterialStateProperty.resolveWith((Set states) { + if (states.contains(MaterialState.disabled)) { return null; } - if (states.contains(WidgetState.selected)) { + if (states.contains(MaterialState.selected)) { return Theme.of(context).colorScheme.secondaryContainer; } return Theme.of(context).colorScheme.surface; })), segments: [ - for (var (index, i) in widget.children.indexed) - ButtonSegment(value: index, label: Text(i)), + for (int index = 0; index < widget.children.length; index++) + ButtonSegment(value: index, label: Text(widget.children[index])), ], selected: {index}, - onSelectionChanged: (p0) { + onSelectionChanged: (Set p0) { widget.onChange(p0.first); if (mounted) setState(() { @@ -57,7 +57,7 @@ class _SortGroupState extends State { style: TextStyle(color: bgColor), ), style: ButtonStyle( - backgroundColor: WidgetStateProperty.all( + backgroundColor: MaterialStateProperty.all( index == widget.children.indexOf(i) ? Theme.of(context).colorScheme.primary : Theme.of(context).cardColor)), diff --git a/lib/component/ugoira_painter.dart b/lib/component/ugoira_painter.dart index 4c4eb9dab..a39a8b9b7 100644 --- a/lib/component/ugoira_painter.dart +++ b/lib/component/ugoira_painter.dart @@ -38,10 +38,10 @@ class UgoiraWidget extends StatefulWidget { : super(key: key); @override - _UgoiraWidgetState createState() => _UgoiraWidgetState(); + _UgoiraMaterialState createState() => _UgoiraMaterialState(); } -class _UgoiraWidgetState extends State with RouteAware { +class _UgoiraMaterialState extends State with RouteAware { Map _map = Map(); Future _loadImage(File file) async { diff --git a/lib/constants.dart b/lib/constants.dart index 701c8b592..1b44e70cb 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -24,5 +24,5 @@ class Constants { static String? code_verifier = null; /// 为true表示使用FluentUI 否则为false,不应作为Desktop的判断 - static final bool isFluent = Platform.isWindows; + static final bool isFluent = false; } diff --git a/lib/er/fluent_leader.dart b/lib/er/fluent_leader.dart index 79e0d4812..ec62415d0 100644 --- a/lib/er/fluent_leader.dart +++ b/lib/er/fluent_leader.dart @@ -1,304 +1,304 @@ -import 'dart:convert'; -import 'dart:io'; +// import 'dart:convert'; +// import 'dart:io'; -import 'package:bot_toast/bot_toast.dart'; -import 'package:dio/dio.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/er/lprinter.dart'; -import 'package:pixez/fluent/page/hello/fluent_hello_page.dart'; -import 'package:pixez/fluent/page/hello/setting/save_eval_page.dart'; -import 'package:pixez/fluent/page/picture/illust_lighting_page.dart'; -import 'package:pixez/fluent/page/search/result_page.dart'; -import 'package:pixez/fluent/page/soup/soup_page.dart'; -import 'package:pixez/fluent/page/user/users_page.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/account.dart'; -import 'package:pixez/network/oauth_client.dart'; -import 'package:pixez/page/novel/viewer/novel_viewer.dart'; -import 'package:url_launcher/url_launcher.dart'; +// import 'package:bot_toast/bot_toast.dart'; +// import 'package:dio/dio.dart'; +// import 'package:fluent_ui/fluent_ui.dart'; +// import 'package:pixez/er/lprinter.dart'; +// import 'package:pixez/fluent/page/hello/fluent_hello_page.dart'; +// import 'package:pixez/fluent/page/hello/setting/save_eval_page.dart'; +// import 'package:pixez/fluent/page/picture/illust_lighting_page.dart'; +// import 'package:pixez/fluent/page/search/result_page.dart'; +// import 'package:pixez/fluent/page/soup/soup_page.dart'; +// import 'package:pixez/fluent/page/user/users_page.dart'; +// import 'package:pixez/i18n.dart'; +// import 'package:pixez/main.dart'; +// import 'package:pixez/models/account.dart'; +// import 'package:pixez/network/oauth_client.dart'; +// import 'package:pixez/page/novel/viewer/novel_viewer.dart'; +// import 'package:url_launcher/url_launcher.dart'; -class FluentLeader { - static Future pushUntilHome(BuildContext context) async { - Navigator.of(context).pushAndRemoveUntil( - FluentPageRoute( - builder: (context) => FluentHelloPage(), - ), - // ignore: unnecessary_null_comparison - (route) => route == null, - ); - } +// class FluentLeader { +// static Future pushUntilHome(BuildContext context) async { +// Navigator.of(context).pushAndRemoveUntil( +// FluentPageRoute( +// builder: (context) => FluentHelloPage(), +// ), +// // ignore: unnecessary_null_comparison +// (route) => route == null, +// ); +// } - static Future pushWithUri(BuildContext context, Uri link) async { - if (link.host == "eval" && link.scheme == "pixez") { - showDialog( - context: context, - builder: (context) => SaveEvalPage( - eval: link.queryParameters["code"] != null - ? String.fromCharCodes( - base64Decode(link.queryParameters["code"]!)) - : null, - ), - useRootNavigator: false); - return; - } - if (link.host == "pixiv.me") { - try { - BotToast.showText(text: "Pixiv me..."); - var dio = Dio(); - Response response = await dio.getUri(link); - if (response.isRedirect == true) { - Uri source = response.realUri; - LPrinter.d("here we go pixiv me:" + source.toString()); - pushWithUri(context, source); - return; - } - } catch (e) { - try { - launchUrl(link); - } catch (e) {} - } - return; - } - if (link.host.contains("pixivision.net")) { - FluentLeader.push( - context, - SoupPage( - url: link.toString().replaceAll("pixez://", "https://"), - spotlight: null), - icon: const Icon(FluentIcons.image_pixel), - title: Text("${I18n.of(context).spotlight}"), - ); - return; - } - if (link.scheme == "pixiv") { - if (link.host.contains("account")) { - try { - BotToast.showText(text: "working...."); - String code = link.queryParameters['code']!; - LPrinter.d("here we go:" + code); - Response response = await oAuthClient.code2Token(code); - AccountResponse accountResponse = - Account.fromJson(response.data).response; - final user = accountResponse.user; - AccountProvider accountProvider = new AccountProvider(); - await accountProvider.open(); - var accountPersist = AccountPersist( - userId: user.id, - userImage: user.profileImageUrls.px170x170, - accessToken: accountResponse.accessToken, - refreshToken: accountResponse.refreshToken, - deviceToken: "", - passWord: "no more", - name: user.name, - account: user.account, - mailAddress: user.mailAddress, - isPremium: user.isPremium ? 1 : 0, - xRestrict: user.xRestrict, - isMailAuthorized: user.isMailAuthorized ? 1 : 0); - await accountProvider.insert(accountPersist); - await accountStore.fetch(); - BotToast.showText(text: "Login Success"); - if (Platform.isIOS) pushUntilHome(context); - } catch (e) { - LPrinter.d(e); - BotToast.showText(text: e.toString()); - } - } else if (link.host.contains("illusts") || - link.host.contains("user") || - link.host.contains("novel")) { - _parseUriContent(context, link); - } - } else if (link.scheme.contains("http")) { - _parseUriContent(context, link); - } else if (link.scheme == "pixez") { - _parseUriContent(context, link); - } - } +// static Future pushWithUri(BuildContext context, Uri link) async { +// if (link.host == "eval" && link.scheme == "pixez") { +// showDialog( +// context: context, +// builder: (context) => SaveEvalPage( +// eval: link.queryParameters["code"] != null +// ? String.fromCharCodes( +// base64Decode(link.queryParameters["code"]!)) +// : null, +// ), +// useRootNavigator: false); +// return; +// } +// if (link.host == "pixiv.me") { +// try { +// BotToast.showText(text: "Pixiv me..."); +// var dio = Dio(); +// Response response = await dio.getUri(link); +// if (response.isRedirect == true) { +// Uri source = response.realUri; +// LPrinter.d("here we go pixiv me:" + source.toString()); +// pushWithUri(context, source); +// return; +// } +// } catch (e) { +// try { +// launchUrl(link); +// } catch (e) {} +// } +// return; +// } +// if (link.host.contains("pixivision.net")) { +// FluentLeader.push( +// context, +// SoupPage( +// url: link.toString().replaceAll("pixez://", "https://"), +// spotlight: null), +// icon: const Icon(FluentIcons.image_pixel), +// title: Text("${I18n.of(context).spotlight}"), +// ); +// return; +// } +// if (link.scheme == "pixiv") { +// if (link.host.contains("account")) { +// try { +// BotToast.showText(text: "working...."); +// String code = link.queryParameters['code']!; +// LPrinter.d("here we go:" + code); +// Response response = await oAuthClient.code2Token(code); +// AccountResponse accountResponse = +// Account.fromJson(response.data).response; +// final user = accountResponse.user; +// AccountProvider accountProvider = new AccountProvider(); +// await accountProvider.open(); +// var accountPersist = AccountPersist( +// userId: user.id, +// userImage: user.profileImageUrls.px170x170, +// accessToken: accountResponse.accessToken, +// refreshToken: accountResponse.refreshToken, +// deviceToken: "", +// passWord: "no more", +// name: user.name, +// account: user.account, +// mailAddress: user.mailAddress, +// isPremium: user.isPremium ? 1 : 0, +// xRestrict: user.xRestrict, +// isMailAuthorized: user.isMailAuthorized ? 1 : 0); +// await accountProvider.insert(accountPersist); +// await accountStore.fetch(); +// BotToast.showText(text: "Login Success"); +// if (Platform.isIOS) pushUntilHome(context); +// } catch (e) { +// LPrinter.d(e); +// BotToast.showText(text: e.toString()); +// } +// } else if (link.host.contains("illusts") || +// link.host.contains("user") || +// link.host.contains("novel")) { +// _parseUriContent(context, link); +// } +// } else if (link.scheme.contains("http")) { +// _parseUriContent(context, link); +// } else if (link.scheme == "pixez") { +// _parseUriContent(context, link); +// } +// } - static void _parseUriContent(BuildContext context, Uri link) { - if (link.host.contains('illusts')) { - var idSource = link.pathSegments.last; - try { - int id = int.parse(idSource); - FluentLeader.push( - context, - IllustLightingPage(id: id), - icon: Icon(FluentIcons.picture), - title: Text(I18n.of(context).illust_id + ': $id'), - ); - } catch (e) {} - return; - } else if (link.host.contains('user')) { - var idSource = link.pathSegments.last; - try { - int id = int.parse(idSource); - FluentLeader.push( - context, - UsersPage(id: id), - title: Text(I18n.of(context).painter_id + ': ${id}'), - icon: Icon(FluentIcons.account_browser), - ); - } catch (e) {} - return; - } else if (link.host.contains("novel")) { - try { - int id = int.parse(link.pathSegments.last); - Navigator.of(context).push(PixEzPageRoute(builder: (context) { - return NovelViewerPage(id: id); - })); - return; - } catch (e) { - LPrinter.d(e); - } - } else if (link.host.contains('pixiv')) { - if (link.path.contains("artworks")) { - List paths = link.pathSegments; - int index = paths.indexOf("artworks"); - if (index != -1) { - try { - int id = int.parse(paths[index + 1]); - FluentLeader.push( - context, - IllustLightingPage(id: id), - icon: Icon(FluentIcons.picture), - title: Text(I18n.of(context).illust_id + ': $id'), - ); - return; - } catch (e) { - LPrinter.d(e); - } - } - } - if (link.path.contains("users")) { - List paths = link.pathSegments; - int index = paths.indexOf("users"); - if (index != -1) { - try { - int id = int.parse(paths[index + 1]); - FluentLeader.push( - context, - UsersPage(id: id), - title: Text(I18n.of(context).painter_id + ': ${id}'), - icon: Icon(FluentIcons.account_browser), - ); - } catch (e) { - print(e); - } - } - } - if (link.queryParameters['illust_id'] != null) { - try { - var id = link.queryParameters['illust_id']; - FluentLeader.push( - context, - IllustLightingPage(id: int.parse(id!)), - icon: Icon(FluentIcons.picture), - title: Text(I18n.of(context).illust_id + ': $id'), - ); - return; - } catch (e) {} - } - if (link.queryParameters['id'] != null) { - try { - var id = link.queryParameters['id']; - if (!link.path.contains("novel")) - FluentLeader.push( - context, - UsersPage(id: int.parse(id!)), - title: Text(I18n.of(context).painter_id + ': ${id}'), - icon: Icon(FluentIcons.account_browser), - ); - else - Navigator.of(context).push(PixEzPageRoute(builder: (context) { - return NovelViewerPage( - id: int.parse(id!), - novelStore: null, - ); - })); - return; - } catch (e) {} - } - if (link.pathSegments.length >= 2) { - String i = link.pathSegments[link.pathSegments.length - 2]; - if (i == "i") { - try { - int id = int.parse(link.pathSegments[link.pathSegments.length - 1]); - FluentLeader.push( - context, - IllustLightingPage(id: id), - icon: Icon(FluentIcons.picture), - title: Text(I18n.of(context).illust_id + ': $id'), - ); - return; - } catch (e) {} - } else if (i == "u") { - try { - int id = int.parse(link.pathSegments[link.pathSegments.length - 1]); - FluentLeader.push( - context, - UsersPage(id: id), - title: Text(I18n.of(context).painter_id + ': ${id}'), - icon: Icon(FluentIcons.account_browser), - ); - return; - } catch (e) {} - } else if (i == "tags") { - try { - String tag = link.pathSegments[link.pathSegments.length - 1]; - FluentLeader.push( - context, - ResultPage(word: tag), - icon: const Icon(FluentIcons.search), - title: Text('搜索 ${tag}'), - ); - } catch (e) {} - } - } - } - } +// static void _parseUriContent(BuildContext context, Uri link) { +// if (link.host.contains('illusts')) { +// var idSource = link.pathSegments.last; +// try { +// int id = int.parse(idSource); +// FluentLeader.push( +// context, +// IllustLightingPage(id: id), +// icon: Icon(FluentIcons.picture), +// title: Text(I18n.of(context).illust_id + ': $id'), +// ); +// } catch (e) {} +// return; +// } else if (link.host.contains('user')) { +// var idSource = link.pathSegments.last; +// try { +// int id = int.parse(idSource); +// FluentLeader.push( +// context, +// UsersPage(id: id), +// title: Text(I18n.of(context).painter_id + ': ${id}'), +// icon: Icon(FluentIcons.account_browser), +// ); +// } catch (e) {} +// return; +// } else if (link.host.contains("novel")) { +// try { +// int id = int.parse(link.pathSegments.last); +// Navigator.of(context).push(PixEzPageRoute(builder: (context) { +// return NovelViewerPage(id: id); +// })); +// return; +// } catch (e) { +// LPrinter.d(e); +// } +// } else if (link.host.contains('pixiv')) { +// if (link.path.contains("artworks")) { +// List paths = link.pathSegments; +// int index = paths.indexOf("artworks"); +// if (index != -1) { +// try { +// int id = int.parse(paths[index + 1]); +// FluentLeader.push( +// context, +// IllustLightingPage(id: id), +// icon: Icon(FluentIcons.picture), +// title: Text(I18n.of(context).illust_id + ': $id'), +// ); +// return; +// } catch (e) { +// LPrinter.d(e); +// } +// } +// } +// if (link.path.contains("users")) { +// List paths = link.pathSegments; +// int index = paths.indexOf("users"); +// if (index != -1) { +// try { +// int id = int.parse(paths[index + 1]); +// FluentLeader.push( +// context, +// UsersPage(id: id), +// title: Text(I18n.of(context).painter_id + ': ${id}'), +// icon: Icon(FluentIcons.account_browser), +// ); +// } catch (e) { +// print(e); +// } +// } +// } +// if (link.queryParameters['illust_id'] != null) { +// try { +// var id = link.queryParameters['illust_id']; +// FluentLeader.push( +// context, +// IllustLightingPage(id: int.parse(id!)), +// icon: Icon(FluentIcons.picture), +// title: Text(I18n.of(context).illust_id + ': $id'), +// ); +// return; +// } catch (e) {} +// } +// if (link.queryParameters['id'] != null) { +// try { +// var id = link.queryParameters['id']; +// if (!link.path.contains("novel")) +// FluentLeader.push( +// context, +// UsersPage(id: int.parse(id!)), +// title: Text(I18n.of(context).painter_id + ': ${id}'), +// icon: Icon(FluentIcons.account_browser), +// ); +// else +// Navigator.of(context).push(PixEzPageRoute(builder: (context) { +// return NovelViewerPage( +// id: int.parse(id!), +// novelStore: null, +// ); +// })); +// return; +// } catch (e) {} +// } +// if (link.pathSegments.length >= 2) { +// String i = link.pathSegments[link.pathSegments.length - 2]; +// if (i == "i") { +// try { +// int id = int.parse(link.pathSegments[link.pathSegments.length - 1]); +// FluentLeader.push( +// context, +// IllustLightingPage(id: id), +// icon: Icon(FluentIcons.picture), +// title: Text(I18n.of(context).illust_id + ': $id'), +// ); +// return; +// } catch (e) {} +// } else if (i == "u") { +// try { +// int id = int.parse(link.pathSegments[link.pathSegments.length - 1]); +// FluentLeader.push( +// context, +// UsersPage(id: id), +// title: Text(I18n.of(context).painter_id + ': ${id}'), +// icon: Icon(FluentIcons.account_browser), +// ); +// return; +// } catch (e) {} +// } else if (i == "tags") { +// try { +// String tag = link.pathSegments[link.pathSegments.length - 1]; +// FluentLeader.push( +// context, +// ResultPage(word: tag), +// icon: const Icon(FluentIcons.search), +// title: Text('搜索 ${tag}'), +// ); +// } catch (e) {} +// } +// } +// } +// } - static Future pushWithScaffold(context, Widget widget, - {Widget? icon, Widget? title}) { - return FluentLeader.push( - context, - ScaffoldPage(content: widget), - icon: icon, - title: title, - ); - } +// static Future pushWithScaffold(context, Widget widget, +// {Widget? icon, Widget? title}) { +// return FluentLeader.push( +// context, +// ScaffoldPage(content: widget), +// icon: icon, +// title: title, +// ); +// } - static Future push( - BuildContext context, - Widget widget, { - Widget? icon, - Widget? title, - bool forceSkipWrap = false, - }) { - final _final = forceSkipWrap - ? widget - : widget is ScaffoldPage - ? widget - : ScaffoldPage( - content: widget, - padding: EdgeInsets.all(0.0), - ); +// static Future push( +// BuildContext context, +// Widget widget, { +// Widget? icon, +// Widget? title, +// bool forceSkipWrap = false, +// }) { +// final _final = forceSkipWrap +// ? widget +// : widget is ScaffoldPage +// ? widget +// : ScaffoldPage( +// content: widget, +// padding: EdgeInsets.all(0.0), +// ); - var state = context.findAncestorStateOfType(); - if (state == null) state = FluentHelloPageState.state; - assert(state != null); - if (icon == null || title == null) { - debugPrint('icon: $icon'); - debugPrint('title: $title'); - debugPrintStack(); - } - return state!.push( - context, - PixEzPageRoute( - builder: (_) => _final, - icon: icon ?? const Icon(FluentIcons.unknown), - title: title ?? Text(I18n.of(context).undefined), - ), - ); - } -} +// var state = context.findAncestorStateOfType(); +// if (state == null) state = FluentHelloPageState.state; +// assert(state != null); +// if (icon == null || title == null) { +// debugPrint('icon: $icon'); +// debugPrint('title: $title'); +// debugPrintStack(); +// } +// return state!.push( +// context, +// PixEzPageRoute( +// builder: (_) => _final, +// icon: icon ?? const Icon(FluentIcons.unknown), +// title: title ?? Text(I18n.of(context).undefined), +// ), +// ); +// } +// } diff --git a/lib/er/leader.dart b/lib/er/leader.dart index 5b49456c9..82ec56dc9 100644 --- a/lib/er/leader.dart +++ b/lib/er/leader.dart @@ -39,7 +39,7 @@ import 'package:url_launcher/url_launcher.dart'; class Leader { static Future pushUntilHome(BuildContext context) async { if (Constants.isFluent) { - FluentLeader.pushUntilHome(context); + // FluentLeader.pushUntilHome(context); return; } Navigator.of(context).pushAndRemoveUntil( @@ -57,7 +57,7 @@ class Leader { static Future pushWithUri(BuildContext context, Uri link) async { if (Constants.isFluent) { - FluentLeader.pushWithUri(context, link); + // FluentLeader.pushWithUri(context, link); return false; } // https://www.pixiv.net/novel/series/$id @@ -296,8 +296,8 @@ class Leader { static Future pushWithScaffold(context, Widget widget, {Widget? icon, Widget? title}) { if (Constants.isFluent) { - return FluentLeader.pushWithScaffold(context, widget, - icon: icon, title: title); + // return FluentLeader.pushWithScaffold(context, widget, + // icon: icon, title: title); } return Navigator.of(context).push(MaterialPageRoute( builder: (context) => Scaffold( @@ -313,8 +313,8 @@ class Leader { bool forceSkipWrap = false, }) { if (Constants.isFluent) { - return FluentLeader.push(context, widget, - icon: icon, title: title, forceSkipWrap: forceSkipWrap); + // return FluentLeader.push(context, widget, + // icon: icon, title: title, forceSkipWrap: forceSkipWrap); } return Navigator.of(context).push(MaterialPageRoute( builder: (context) => Scaffold( diff --git a/lib/fluent/component/ban_page.dart b/lib/fluent/component/ban_page.dart deleted file mode 100644 index 29ed93d23..000000000 --- a/lib/fluent/component/ban_page.dart +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/fluent/page/shield/shield_page.dart'; -import 'package:pixez/i18n.dart'; - -class BanPage extends StatefulWidget { - final String name; - final VoidCallback? onPressed; - - const BanPage({Key? key, required this.name, this.onPressed}) - : super(key: key); - - @override - _BanPageState createState() => _BanPageState(); -} - -class _BanPageState extends State { - @override - Widget build(BuildContext context) { - return ScaffoldPage( - content: Center( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - 'X_X', - style: TextStyle(fontSize: 26), - ), - ), - Text( - I18n.of(context).shield_message(widget.name), - textAlign: TextAlign.center, - ), - Padding( - padding: const EdgeInsets.only( - top: 8.0, - ), - child: FilledButton( - child: Text(I18n.of(context).shielding_settings), - onPressed: () { - showDialog( - context: context, - builder: (context) => ShieldPage(), - ); - }, - ), - ), - HyperlinkButton( - onPressed: () { - if (widget.onPressed != null) widget.onPressed!(); - }, - child: Text(I18n.of(context).temporarily_visible)), - ], - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - ), - ), - ); - } -} diff --git a/lib/fluent/component/context_menu.dart b/lib/fluent/component/context_menu.dart deleted file mode 100644 index dc378db40..000000000 --- a/lib/fluent/component/context_menu.dart +++ /dev/null @@ -1,42 +0,0 @@ -import 'package:fluent_ui/fluent_ui.dart'; - -class ContextMenu extends StatefulWidget { - final Widget child; - final List items; - - ContextMenu({super.key, required this.child, required this.items}); - - @override - State createState() => _ContextMenuState(); -} - -class _ContextMenuState extends State { - final _key = GlobalKey(); - final _controller = FlyoutController(); - @override - Widget build(BuildContext context) => FlyoutTarget( - key: _key, - controller: _controller, - child: GestureDetector( - child: widget.child, - onSecondaryTapUp: (details) { - _controller.showFlyout( - position: _getPosition(context, details.localPosition), - builder: (context) => MenuFlyout(items: widget.items), - ); - }, - ), - ); - - Offset? _getPosition( - BuildContext context, - Offset localPosition, - ) { - // This calculates the position of the flyout according to the parent navigator - final box = context.findRenderObject() as RenderBox; - return box.localToGlobal( - localPosition, - ancestor: Navigator.of(context).context.findRenderObject(), - ); - } -} diff --git a/lib/fluent/component/focus_wrap.dart b/lib/fluent/component/focus_wrap.dart deleted file mode 100644 index aa8c0769c..000000000 --- a/lib/fluent/component/focus_wrap.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'package:fluent_ui/fluent_ui.dart'; - -class FocusWrap extends StatefulWidget { - final Widget child; - final void Function() onInvoke; - final bool? renderOutside; - - FocusWrap( - {super.key, - required this.child, - required this.onInvoke, - this.renderOutside}); - - @override - State createState() => _FocusWrapState(); -} - -class _FocusWrapState extends State { - bool _shouldShowFocus = false; - @override - Widget build(BuildContext context) => Padding( - padding: widget.renderOutside != null - ? EdgeInsets.zero - : const EdgeInsets.all(2.0), - child: FocusableActionDetector( - child: FocusBorder( - child: widget.child, - focused: _shouldShowFocus, - renderOutside: widget.renderOutside, - ), - onShowFocusHighlight: (v) { - if (mounted) setState(() => _shouldShowFocus = v); - }, - actions: { - ActivateIntent: CallbackAction( - onInvoke: (intent) => widget.onInvoke(), - ), - }, - ), - ); -} diff --git a/lib/fluent/component/illust_card.dart b/lib/fluent/component/illust_card.dart deleted file mode 100644 index 9b6b4d2bd..000000000 --- a/lib/fluent/component/illust_card.dart +++ /dev/null @@ -1,371 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:ffi'; - -import 'package:bot_toast/bot_toast.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/clipboard_plugin.dart'; -import 'package:pixez/component/null_hero.dart'; -import 'package:pixez/component/star_icon.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/er/lprinter.dart'; -import 'package:pixez/fluent/component/pixez_button.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/lighting/lighting_store.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/fluent/page/picture/illust_lighting_page.dart'; -import 'package:pixez/fluent/page/picture/picture_list_page.dart'; -import 'package:pixez/fluent/page/picture/tag_for_illust_page.dart'; -import 'package:pixez/page/picture/illust_store.dart'; -import 'context_menu.dart'; - -class IllustCard extends StatefulWidget { - final IllustStore store; - final List? iStores; - final bool needToBan; - final LightingStore lightingStore; - - IllustCard({ - required this.store, - required this.lightingStore, - this.iStores, - this.needToBan = false, - }); - - @override - _IllustCardState createState() => _IllustCardState(); -} - -class _IllustCardState extends State { - late IllustStore store; - late List? iStores; - late String tag; - late LightingStore _lightingStore; - - @override - void initState() { - store = widget.store; - iStores = widget.iStores; - _lightingStore = widget.lightingStore; - tag = this.hashCode.toString(); - super.initState(); - } - - @override - void didUpdateWidget(covariant IllustCard oldWidget) { - super.didUpdateWidget(oldWidget); - store = widget.store; - iStores = widget.iStores; - _lightingStore = widget.lightingStore; - } - - @override - void dispose() { - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return ContextMenu( - child: _build(context), - items: [ - MenuFlyoutItem( - leading: Observer(builder: (context) { - switch (store.state) { - case 0: - return Icon(FluentIcons.heart); - case 1: - return Icon(FluentIcons.heart_fill); - default: - return Icon( - FluentIcons.heart_fill, - color: Colors.red, - ); - } - }), - text: Text(I18n.of(context).bookmark), - onPressed: () async { - await _onStar(); - }, - ), - if (ClipboardPlugin.supported) - MenuFlyoutItem( - leading: Icon(FluentIcons.copy), - text: Text(I18n.of(context).copy), - onPressed: () async { - final url = ClipboardPlugin.getImageUrl(store.illusts!, 0); - if (url == null) return; - - ClipboardPlugin.showToast( - context, - ClipboardPlugin.copyImageFromUrl(url), - ); - }, - ), - MenuFlyoutItem( - leading: Icon(FluentIcons.save), - text: Text(I18n.of(context).save), - onPressed: () async { - await _onSave(); - }, - ), - MenuFlyoutItem( - leading: Icon(FluentIcons.favorite_list), - text: Text(I18n.of(context).favorited_tag), - onPressed: () async { - final result = await showDialog( - context: context, - builder: (context) => TagForIllustPage(id: store.illusts!.id), - ); - if (result?.isNotEmpty ?? false) { - LPrinter.d(result); - String restrict = result['restrict']; - List? tags = result['tags']; - store.star(restrict: restrict, tags: tags, force: true); - } - }, - ), - ], - ); - } - - Widget _build(BuildContext context) { - if (userSetting.hIsNotAllow) { - final iR18 = - store.illusts?.tags.indexWhere((I) => I.name.startsWith('R-18')); - if (iR18 != null && iR18 != -1) { - return PixEzButton( - onPressed: () => _buildTap(context), - child: Image.asset('assets/images/h.jpg'), - ); - } - } - - return buildInkWell(context); - } - - _onSave() async { - if (userSetting.longPressSaveConfirm) { - final result = await showDialog( - context: context, - builder: (context) { - return ContentDialog( - title: Text(I18n.of(context).save), - content: Text(store.illusts?.title ?? ""), - actions: [ - HyperlinkButton( - child: Text(I18n.of(context).cancel), - onPressed: () { - Navigator.of(context).pop(false); - }, - ), - HyperlinkButton( - child: Text(I18n.of(context).ok), - onPressed: () { - Navigator.of(context).pop(true); - }, - ), - ], - ); - }); - if (result != true) { - return; - } - } - saveStore.saveImage(store.illusts!); - } - - Future _buildTap(BuildContext context) { - return Leader.push( - context, - PictureListPage( - iStores: iStores!, - store: store, - lightingStore: _lightingStore, - heroString: tag, - ), - icon: const Icon(FluentIcons.picture), - title: Text(I18n.of(context).illust_id + ': ${store.id}'), - ); - } - - Widget cardText() { - if (store.illusts!.type != "illust") { - return Text( - store.illusts!.type, - style: TextStyle(color: Colors.white), - ); - } - if (store.illusts!.metaPages.isNotEmpty) { - return Text( - store.illusts!.metaPages.length.toString(), - style: TextStyle(color: Colors.white), - ); - } - return Text(''); - } - - Widget _buildPic(String tag, bool tooLong) { - return tooLong - ? NullHero( - tag: tag, - child: PixivImage(store.illusts!.imageUrls.squareMedium, - fit: BoxFit.fitWidth), - ) - : NullHero( - tag: tag, - child: PixivImage(store.illusts!.imageUrls.medium, - fit: BoxFit.fitWidth), - ); - } - - Widget buildInkWell(BuildContext context) { - var tooLong = - store.illusts!.height.toDouble() / store.illusts!.width.toDouble() > 3; - var radio = (tooLong) - ? 1.0 - : store.illusts!.width.toDouble() / store.illusts!.height.toDouble(); - return _buildAnimationWraper( - context, - Column( - children: [ - AspectRatio( - aspectRatio: radio, - child: Stack( - children: [ - Positioned.fill(child: _buildPic(tag, tooLong)), - Positioned(top: 5.0, right: 5.0, child: _buildVisibility()), - ], - )), - _buildBottom(context), - ], - )); - } - - Widget _buildAnimationWraper(BuildContext context, Widget child) { - return PixEzButton( - child: child, - onPressed: () { - _buildInkTap(context, tag); - }, - ); - } - - Future _buildInkTap(BuildContext context, String heroTag) { - Widget widget; - if (iStores != null) { - widget = PictureListPage( - heroString: heroTag, - store: store, - lightingStore: _lightingStore, - iStores: iStores!, - ); - } else { - widget = IllustLightingPage( - id: store.illusts!.id, - heroString: heroTag, - store: store, - ); - } - return Leader.push( - context, - widget, - icon: Icon(FluentIcons.picture), - title: Text(I18n.of(context).illust_id + ': ${store.illusts!.id}'), - ); - } - - _onStar() async { - store.star(restrict: userSetting.defaultPrivateLike ? "private" : "public"); - if (!userSetting.followAfterStar) { - return; - } - bool success = await store.followAfterStar(); - if (success) { - BotToast.showText( - text: "${store.illusts!.user.name} ${I18n.of(context).followed}"); - } - } - - Widget _buildBottom(BuildContext context) { - return Container( - color: FluentTheme.of(context).cardColor, - child: Stack( - children: [ - Padding( - padding: const EdgeInsets.only( - left: 8.0, right: 36.0, top: 4, bottom: 4), - child: - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - store.illusts!.title, - maxLines: 1, - overflow: TextOverflow.clip, - style: FluentTheme.of(context).typography.bodyStrong, - strutStyle: StrutStyle(forceStrutHeight: true, leading: 0), - ), - Text( - store.illusts!.user.name, - maxLines: 1, - overflow: TextOverflow.clip, - style: FluentTheme.of(context).typography.body, - strutStyle: StrutStyle(forceStrutHeight: true, leading: 0), - ) - ]), - ), - Align( - alignment: Alignment.centerRight, - child: GestureDetector( - child: Observer(builder: (_) { - return StarIcon( - state: store.state, - ); - }), - onTap: _onStar, - ), - ) - ], - ), - ); - } - - Widget _buildVisibility() { - return Visibility( - visible: store.illusts!.type != "illust" || - store.illusts!.metaPages.isNotEmpty, - child: Align( - alignment: Alignment.topRight, - child: Padding( - padding: EdgeInsets.all(4.0), - child: Container( - child: Padding( - padding: - const EdgeInsets.symmetric(vertical: 2.0, horizontal: 2.0), - child: cardText(), - ), - decoration: BoxDecoration( - color: Colors.black, - borderRadius: BorderRadius.all(Radius.circular(4.0)), - ), - ), - ), - ), - ); - } -} diff --git a/lib/fluent/component/new_version_chip.dart b/lib/fluent/component/new_version_chip.dart deleted file mode 100644 index 48e1deeac..000000000 --- a/lib/fluent/component/new_version_chip.dart +++ /dev/null @@ -1,18 +0,0 @@ - -import 'package:fluent_ui/fluent_ui.dart'; - -class NewVersionChip extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - child: Text( - "New", - style: TextStyle(color: Colors.white, fontSize: 12.0), - ), - padding: EdgeInsets.symmetric(horizontal: 4.0, vertical: 2), - decoration: BoxDecoration( - color: Colors.red, - borderRadius: BorderRadius.all(Radius.circular(24.0))), - ); - } -} diff --git a/lib/fluent/component/painer_card.dart b/lib/fluent/component/painer_card.dart deleted file mode 100644 index 3f49ea787..000000000 --- a/lib/fluent/component/painer_card.dart +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/fluent/component/painter_avatar.dart'; -import 'package:pixez/fluent/component/pixez_button.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/models/user_preview.dart'; -import 'package:pixez/page/novel/user/novel_users_page.dart'; -import 'package:pixez/page/user/user_store.dart'; -import 'package:pixez/fluent/page/user/users_page.dart'; - -class PainterCard extends StatelessWidget { - final UserPreviews user; - final bool isNovel; - - const PainterCard({Key? key, required this.user, this.isNovel = false}) - : super(key: key); - - @override - Widget build(BuildContext context) { - return PixEzButton( - child: CustomScrollView( - physics: NeverScrollableScrollPhysics(), - slivers: [ - SliverGrid( - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), - delegate: SliverChildBuilderDelegate((context, index) { - if (index >= user.illusts.length) return Container(); - return PixivImage( - user.illusts[index].imageUrls.squareMedium, - fit: BoxFit.cover, - ); - }, childCount: user.illusts.length)), - SliverToBoxAdapter(child: buildPadding(context)) - ], - ), - onPressed: () { - Widget widget; - if (isNovel) { - widget = NovelUsersPage( - id: user.user.id, - ); - } else { - widget = UsersPage( - id: user.user.id, - userStore: UserStore(user.user.id, null, user.user), - ); - } - Leader.push(context, widget, - title: Text(I18n.of(context).painter_id + ': ${user.user.id}'), - icon: Icon(FluentIcons.account_browser)); - }, - ); - } - - Padding buildPadding(BuildContext context) { - return Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Hero( - tag: user.user.profileImageUrls.medium + this.hashCode.toString(), - child: PainterAvatar( - url: user.user.profileImageUrls.medium, - id: user.user.id, - onTap: () { - Widget widget; - if (isNovel) { - widget = NovelUsersPage( - id: user.user.id, - ); - } else { - widget = UsersPage( - id: user.user.id, - userStore: UserStore(user.user.id, null, user.user), - heroTag: this.hashCode.toString(), - ); - } - Leader.push(context, widget, - title: - Text(I18n.of(context).painter_id + ': ${user.user.id}'), - icon: Icon(FluentIcons.account_browser)); - }, - ), - ), - Padding( - padding: const EdgeInsets.all(16.0), - child: Text(user.user.name), - ), - ], - ), - ); - } -} diff --git a/lib/fluent/component/painter_avatar.dart b/lib/fluent/component/painter_avatar.dart deleted file mode 100644 index 1cc1771f3..000000000 --- a/lib/fluent/component/painter_avatar.dart +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/fluent/component/focus_wrap.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/fluent/page/user/users_page.dart'; - -class PainterAvatar extends StatefulWidget { - final String url; - final int id; - final GestureTapCallback? onTap; - final Size? size; - - const PainterAvatar( - {Key? key, required this.url, required this.id, this.onTap, this.size}) - : super(key: key); - - @override - _PainterAvatarState createState() => _PainterAvatarState(); -} - -class _PainterAvatarState extends State { - void pushToUserPage() { - Leader.push( - context, - UsersPage(id: widget.id), - title: Text(I18n.of(context).painter_id + ': ${widget.id}'), - icon: Icon(FluentIcons.account_browser), - ); - } - - _onTap() { - if (widget.onTap == null) - pushToUserPage(); - else - widget.onTap!(); - } - - @override - Widget build(BuildContext context) { - return FocusWrap( - onInvoke: _onTap, - child: GestureDetector( - onTap: _onTap, - child: widget.size == null - ? SizedBox( - height: 60, - width: 60, - child: CircleAvatar( - backgroundImage: PixivProvider.url( - widget.url, - preUrl: widget.url, - ), - radius: 100.0, - backgroundColor: FluentTheme.of(context).accentColor, - ), - ) - : Container( - height: widget.size!.height, - width: widget.size!.width, - decoration: BoxDecoration( - shape: BoxShape.circle, - image: DecorationImage( - image: PixivProvider.url( - widget.url, - preUrl: widget.url, - ), - fit: BoxFit.cover, - ), - ), - ), - ), - ); - } -} diff --git a/lib/fluent/component/pixez_button.dart b/lib/fluent/component/pixez_button.dart deleted file mode 100644 index e592711bf..000000000 --- a/lib/fluent/component/pixez_button.dart +++ /dev/null @@ -1,33 +0,0 @@ -import 'package:fluent_ui/fluent_ui.dart'; - -class PixEzButton extends StatelessWidget { - final Widget child; - final void Function() onPressed; - final bool noPadding; - - const PixEzButton({ - super.key, - required this.child, - required this.onPressed, - this.noPadding = false, - }); - - @override - Widget build(BuildContext context) => Padding( - padding: noPadding ? EdgeInsets.zero : const EdgeInsets.all(4.0), - child: ButtonTheme( - data: ButtonThemeData( - iconButtonStyle: ButtonStyle( - padding: ButtonState.all(EdgeInsets.zero), - ), - ), - child: IconButton( - icon: ClipRRect( - borderRadius: const BorderRadius.all(const Radius.circular(4.0)), - child: child, - ), - onPressed: onPressed, - ), - ), - ); -} diff --git a/lib/fluent/component/pixiv_image.dart b/lib/fluent/component/pixiv_image.dart deleted file mode 100644 index 3a16e1902..000000000 --- a/lib/fluent/component/pixiv_image.dart +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:io'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_cache_manager/flutter_cache_manager.dart'; -import 'package:http/io_client.dart'; -import 'package:http_interceptor/http_interceptor.dart'; -import 'package:pixez/er/hoster.dart'; -import 'package:pixez/exts.dart'; -import 'package:pixez/main.dart'; - -const ImageHost = "i.pximg.net"; -const ImageCatHost = "i.pixiv.re"; -const ImageSHost = "s.pximg.net"; - -// 注意,stable的http_interceptor这里是无效的,因为实现send是todo -// 实现CacheManager和混入ImageCacheManager缺一不可 -// 如果你恰好看到这个实现方法实例,且对你有些帮助或者启发: -// 听一首Mili-Salt, Pepper, Birds, And the Thought Police吧 🎵 -class PixivHostInterceptor implements InterceptorContract { - @override - Future interceptRequest({required BaseRequest request}) async { - if (request.url.host == "s.pximg.net") { - request.headers["Host"] = request.url.host; - return request; - } - Uri uri = request.url.toTureUri(); - request.headers["Host"] = uri.host; - return request.copyWith(url: uri, headers: request.headers); - } - - @override - Future interceptResponse( - {required BaseResponse response}) async { - if (response.statusCode != 200) { - splashStore.maybeFetch(); - } - return response; - } - - @override - Future shouldInterceptRequest() async { - return true; - } - - @override - Future shouldInterceptResponse() async { - return true; - } -} - -class PixivCacheManager extends CacheManager with ImageCacheManager { - static const key = 'PixezCachedImageData'; - - PixivCacheManager() - : super(Config( - key, - repo: JsonCacheInfoRepository(databaseName: key), - fileService: HttpFileService( - httpClient: InterceptedClient.build( - interceptors: [ - PixivHostInterceptor(), - ], - client: IOClient(HttpClient() - ..badCertificateCallback = - (X509Certificate cert, String host, int port) => - true))), - )); -} - -PixivCacheManager pixivCacheManager = PixivCacheManager(); - -class PixivImage extends StatefulWidget { - final String url; - final Widget? placeWidget; - final bool fade; - final BoxFit? fit; - final bool? enableMemoryCache; - final double? height; - final double? width; - final String? host; - - PixivImage(this.url, - {this.placeWidget, - this.fade = true, - this.fit, - this.enableMemoryCache, - this.height, - this.host, - this.width}); - - @override - _PixivImageState createState() => _PixivImageState(); -} - -class _PixivImageState extends State { - late String url; - bool already = false; - bool? enableMemoryCache; - double? width; - double? height; - BoxFit? fit; - bool fade = true; - Widget? placeWidget; - - @override - void initState() { - url = widget.url; - enableMemoryCache = widget.enableMemoryCache ?? true; - width = widget.width; - height = widget.height; - fit = widget.fit; - fade = widget.fade; - placeWidget = widget.placeWidget; - super.initState(); - } - - @override - void didUpdateWidget(covariant PixivImage oldWidget) { - super.didUpdateWidget(oldWidget); - if (oldWidget.url != widget.url) { - setState(() { - url = widget.url; - width = widget.width; - height = widget.height; - }); - } - } - - @override - Widget build(BuildContext context) { - return CachedNetworkImage( - placeholder: (context, url) => - widget.placeWidget ?? Container(height: height), - errorWidget: (context, url, _) => Container( - height: height, - child: Center( - child: HyperlinkButton( - onPressed: () { - setState(() {}); - }, - child: Text(":("), - ), - ), - ), - fadeOutDuration: - widget.fade ? const Duration(milliseconds: 1000) : null, - // memCacheWidth: width?.toInt(), - // memCacheHeight: height?.toInt(), - imageUrl: url, - cacheManager: pixivCacheManager, - height: height, - width: width, - fit: fit ?? BoxFit.fitWidth, - httpHeaders: Hoster.header(url: url)); - } -} - -class PixivProvider { - static CachedNetworkImageProvider url(String url, {String? preUrl}) { - return CachedNetworkImageProvider(url, - headers: Hoster.header(url: preUrl), cacheManager: pixivCacheManager); - } -} - -// class RubyProvider extends ImageProvider{ -// @override -// ImageStreamCompleter load(Object key, Future Function(Uint8List bytes, {bool allowUpscaling, int cacheHeight, int cacheWidth}) decode) { -// // TODO: implement load -// throw UnimplementedError(); -// } -// -// @override -// Future obtainKey(ImageConfiguration configuration) { -// // TODO: implement obtainKey -// throw UnimplementedError(); -// } -// } diff --git a/lib/fluent/component/search_box.dart b/lib/fluent/component/search_box.dart deleted file mode 100644 index 1428f67ec..000000000 --- a/lib/fluent/component/search_box.dart +++ /dev/null @@ -1,470 +0,0 @@ -import 'dart:async'; - -import 'package:bot_toast/bot_toast.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/fluent/component/pixez_button.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/tags.dart'; -import 'package:pixez/models/trend_tags.dart'; -import 'package:pixez/fluent/page/picture/illust_lighting_page.dart'; -import 'package:pixez/fluent/page/search/result_page.dart'; -import 'package:pixez/fluent/page/soup/soup_page.dart'; -import 'package:pixez/fluent/page/user/users_page.dart'; -import 'package:pixez/page/saucenao/sauce_store.dart'; -import 'package:pixez/page/search/suggest/suggestion_store.dart'; -import 'package:pixez/page/search/trend_tags_store.dart'; - -class SearchBox extends StatefulWidget { - @override - State createState() => _SearchBoxState(); -} - -class _SearchBoxState extends State { - final GlobalKey> _key = - GlobalKey>(); - final TextEditingController _controller = TextEditingController(); - final SuggestionStore _suggestionStore = SuggestionStore(); - final SauceStore _sauceStore = SauceStore(); - final TrendTagsStore _trendTagsStore = TrendTagsStore(); - final List tagGroup = []; - final FocusNode _focusNode = FocusNode(); - List> _items = []; - bool _isLoading = false; - - @override - void initState() { - _sauceStore.observableStream.listen((event) { - if (event != null && _sauceStore.results.isNotEmpty) { - Leader.push( - context, - PageView( - children: _sauceStore.results - .map((element) => IllustLightingPage(id: element)) - .toList(), - ), - icon: Icon(FluentIcons.search), - title: Text(I18n.of(context).search), - ); - } else { - BotToast.showText(text: "0 result"); - } - }); - _focusNode.addListener(() { - if (_focusNode.hasFocus && _key.currentState?.isOverlayVisible == false) { - _key.currentState?.showOverlay(); - } else if (_key.currentState?.isOverlayVisible == true) { - _key.currentState?.dismissOverlay(); - } - }); - - super.initState(); - _updateSuggestList(); - } - - @override - void dispose() { - _focusNode.dispose(); - _controller.dispose(); - _sauceStore.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return AutoSuggestBox<_SuggestItem>( - key: _key, - items: _items, - controller: _controller, - focusNode: _focusNode, - onChanged: _onAutoSuggestBoxChanged, - onSelected: _onAutoSuggestBoxSelected, - placeholder: I18n.of(context).search, - leadingIcon: IconButton( - icon: const Icon(FluentIcons.image_search), - onPressed: _sauceStore.findImage, - ), - trailingIcon: Row( - mainAxisSize: MainAxisSize.min, - children: [ - if (_isLoading) - SizedBox( - width: 16, - height: 16, - child: ProgressRing( - strokeWidth: 3.0, - ), - ), - IconButton( - icon: const Icon(FluentIcons.search), - onPressed: () => Leader.push( - context, - ResultPage(word: _controller.text), - icon: const Icon(FluentIcons.search), - title: Text('搜索 ${_controller.text}'), - ), - ) - ], - ), - ); - } - - Timer? _delay; - bool _skipClear = false; - void _notifyFinished() { - _isLoading = false; - // HACK: 通知 AutoSuggestBox 使内部的 ListView 更新 - // ignore: invalid_use_of_protected_member, invalid_use_of_visible_for_testing_member - _controller.notifyListeners(); - if (!mounted) return; - setState(() {}); - } - - Future _updateSuggestList() async { - if (!mounted) return; - final text = _controller.text; - if (!_skipClear || text.isEmpty) _items.clear(); - _skipClear = false; - _isLoading = true; - setState(() {}); - - if (text.isEmpty) { - // 如果搜索框为空则展示历史记录 - await tagHistoryStore.fetch(); - // 历史记录为空则不展示 - if (tagHistoryStore.tags.isEmpty) return _notifyFinished(); - - if (!mounted) return; - _items.addAll([ - _getCleanHistoryItem(), - ...tagHistoryStore.tags.map(_getItemByTagsPersist), - ]); - return _notifyFinished(); - } else if (text.startsWith('#')) { - // 如果搜索框以 # 开头则展示标签 - - // 标签不能搜索所以跳过下一次的列表清除 - _skipClear = true; - // 如果不是单独的 # 符号 则用户可能想要筛选标签结果 - if (text != '#') return _notifyFinished(); - - await _trendTagsStore.fetch(); - - _items.addAll(_trendTagsStore.trendTags.map(_getItemByTrendTags)); - _notifyFinished(); - } else { - // 都不是则尝试搜索 - // 如果输入了数字则展示快速跳转 - final id = int.tryParse(text); - if (id != null) { - _items.addAll([ - _getItemByIllustId(id), - _getItemByPainterId(id), - _getItemByPixivisionId(id), - ]); - _notifyFinished(); - } - - // 取消挂起的异步搜索 - _delay?.cancel(); - - // 创建新的异步搜索 - _delay = Timer(const Duration(seconds: 1), () async { - await _suggestionStore.fetch(text); - final autoWords = _suggestionStore.autoWords; - if (autoWords != null) - _items.addAll(autoWords.tags.map(_getItemByTags).toList()); - - _notifyFinished(); - }); - } - } - - void _onAutoSuggestBoxChanged(String text, TextChangedReason reason) { - if (reason == TextChangedReason.suggestionChosen) { - _controller.clear(); - setState(() {}); - return; - } - - _updateSuggestList(); - } - - AutoSuggestBoxItem<_SuggestItem> _buildItem({ - required String title, - required _SuggestItem value, - String? subtitle = null, - Widget? leading = null, - Widget? trailing = null, - void Function()? onSelected, - bool reverse = false, - }) { - return AutoSuggestBoxItem<_SuggestItem>( - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - if (leading != null) - Padding( - padding: EdgeInsets.only(right: 4.0), - child: leading, - ), - Expanded( - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - subtitle != null && subtitle.isNotEmpty && reverse - ? subtitle - : title, - style: reverse - ? null - : FluentTheme.of(context).typography.body?.copyWith( - color: FluentTheme.of(context).accentColor, - ), - ), - if (subtitle != null && subtitle.isNotEmpty) - Padding( - padding: EdgeInsets.only(left: 4.0), - child: Text( - reverse ? title : subtitle, - style: reverse - ? FluentTheme.of(context).typography.body?.copyWith( - color: FluentTheme.of(context).accentColor, - ) - : null, - ), - ), - ], - ), - ), - if (trailing != null) - Padding( - padding: EdgeInsets.only(left: 4.0), - child: trailing, - ), - ], - ), - label: "$title $subtitle", - value: value, - onSelected: onSelected, - ); - } - - Widget _buildTagImage(TrendTags tags) { - return PixEzButton( - noPadding: true, - child: PixivImage( - tags.illust.imageUrls.squareMedium, - fit: BoxFit.cover, - height: 26, - ), - onPressed: () { - Leader.push( - context, - IllustLightingPage(id: tags.illust.id), - icon: Icon(FluentIcons.picture), - title: Text( - I18n.of(context).illust_id + ': ${tags.illust.id}', - ), - ); - }, - ); - } - - AutoSuggestBoxItem<_SuggestItem> _getCleanHistoryItem() { - return _buildItem( - leading: Icon(FluentIcons.delete), - title: I18n.of(context).clear_search_tag_history, - value: _SuggestItem(type: _SuggestItemType.cleanHistory), - ); - } - - AutoSuggestBoxItem<_SuggestItem> _getItemByTagsPersist(TagsPersist tags) { - return _buildItem( - title: tags.name, - subtitle: tags.translatedName, - value: _SuggestItem( - type: _SuggestItemType.history, - word: tags.name, - translated: tags.translatedName, - ), - trailing: PixEzButton( - child: Icon(FluentIcons.chrome_close), - onPressed: () { - if (tags.id != null) tagHistoryStore.delete(tags.id!); - _updateSuggestList(); - }, - ), - ); - } - - AutoSuggestBoxItem<_SuggestItem> _getItemByTrendTags(TrendTags tags) { - return _buildItem( - title: "#${tags.tag}", - subtitle: tags.translatedName != null ? "#${tags.translatedName}" : null, - leading: _buildTagImage(tags), - value: _SuggestItem( - word: tags.tag, - translated: tags.translatedName, - ), - ); - } - - AutoSuggestBoxItem<_SuggestItem> _getItemByTags(Tags tags) { - return _buildItem( - title: tags.name, - subtitle: tags.translated_name, - value: _SuggestItem( - word: tags.name, - translated: tags.translated_name, - ), - ); - } - - AutoSuggestBoxItem<_SuggestItem> _getItemByIllustId(int id) { - return _buildItem( - reverse: true, - title: id.toString(), - subtitle: I18n.of(context).illust_id, - value: _SuggestItem( - type: _SuggestItemType.illustId, - id: id, - ), - ); - } - - AutoSuggestBoxItem<_SuggestItem> _getItemByPainterId(int id) { - return _buildItem( - reverse: true, - title: id.toString(), - subtitle: I18n.of(context).painter_id, - value: _SuggestItem( - type: _SuggestItemType.painterId, - id: id, - ), - ); - } - - AutoSuggestBoxItem<_SuggestItem> _getItemByPixivisionId(int id) { - return _buildItem( - reverse: true, - title: id.toString(), - subtitle: 'Pixivision Id', - value: _SuggestItem( - type: _SuggestItemType.pixivisionId, - id: id, - ), - ); - } - - void _onAutoSuggestBoxSelected(AutoSuggestBoxItem<_SuggestItem> value) { - final item = value.value; - if (item == null) return; - switch (item.type) { - case _SuggestItemType.normal: - case _SuggestItemType.tag: - if (tagGroup.length > 1) { - tagGroup.last = item.word!; - final text = tagGroup.join(" "); - _controller.text = text; - _controller.selection = TextSelection.fromPosition( - TextPosition(offset: text.length), - ); - setState(() {}); - return; - } - default: - } - FocusScope.of(context).unfocus(); - switch (item.type) { - case _SuggestItemType.normal: - case _SuggestItemType.history: - case _SuggestItemType.tag: - final prefix = item.type == _SuggestItemType.tag ? '#' : ''; - Leader.push( - context, - ResultPage( - word: item.word!, - translatedName: item.translated ?? '', - ), - icon: Icon(FluentIcons.search), - title: Text('${I18n.of(context).search}: ${prefix}${item.word}'), - ); - case _SuggestItemType.illustId: - Leader.push( - context, - IllustLightingPage(id: item.id!), - icon: const Icon(FluentIcons.image_pixel), - title: Text('${I18n.of(context).illust_id}: ${item.id}'), - ); - case _SuggestItemType.painterId: - Leader.push( - context, - UsersPage(id: item.id!), - icon: const Icon(FluentIcons.image_pixel), - title: Text('${I18n.of(context).painter_id}: ${item.id}'), - ); - case _SuggestItemType.pixivisionId: - Leader.push( - context, - SoupPage( - url: "https://www.pixivision.net/zh/a/${item.id}", - spotlight: null, - ), - icon: const Icon(FluentIcons.image_pixel), - title: Text('Pixivision Id: ${item.id}'), - ); - case _SuggestItemType.cleanHistory: - showDialog( - context: context, - builder: (context) { - return ContentDialog( - title: Text(I18n.of(context).clean_history), - actions: [ - Button( - onPressed: Navigator.of(context).pop, - child: Text(I18n.of(context).cancel), - ), - FilledButton( - onPressed: () async { - await tagHistoryStore.deleteAll(); - _controller.clear(); - await _updateSuggestList(); - Navigator.of(context).pop(); - }, - child: Text(I18n.of(context).ok), - ) - ], - ); - }, - ); - default: - } - } -} - -enum _SuggestItemType { - normal, - history, - tag, - illustId, - painterId, - pixivisionId, - cleanHistory, -} - -class _SuggestItem { - final _SuggestItemType type; - final String? word; - final String? translated; - final int? id; - - const _SuggestItem({ - this.type = _SuggestItemType.normal, - this.word = null, - this.translated = null, - this.id = null, - }); -} diff --git a/lib/fluent/component/selectable_html.dart b/lib/fluent/component/selectable_html.dart deleted file mode 100644 index afe7276b9..000000000 --- a/lib/fluent/component/selectable_html.dart +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:io'; - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/er/lprinter.dart'; -import 'package:pixez/supportor_plugin.dart'; -import 'package:url_launcher/url_launcher.dart'; -import 'package:share_plus/share_plus.dart'; - -class SelectableHtml extends StatefulWidget { - final String data; - - const SelectableHtml({Key? key, required this.data}) : super(key: key); - - @override - _SelectableHtmlState createState() => _SelectableHtmlState(); -} - -class _SelectableHtmlState extends State { - @override - void initState() { - super.initState(); - initMethod(); - } - - @override - Widget build(BuildContext context) { - return Container( - child: HtmlWidget( - widget.data, - customStylesBuilder: (e) { - if (e.attributes.containsKey('href')) { - final color = FluentTheme.of(context).accentColor; - return { - 'color': '#${color.value.toRadixString(16).substring(2, 8)}' - }; - } - return null; - }, - onTapUrl: (String url) async { - try { - LPrinter.d("html tap url: $url"); - if (url.startsWith("pixiv")) { - Leader.pushWithUri(context, Uri.parse(url)); - } else - await launchUrl(Uri.parse(url), - mode: LaunchMode.externalNonBrowserApplication); - } catch (e) { - Share.share(url); - } - return true; - }, - ), - ); - } - - bool supportTranslate = false; - - Future initMethod() async { - if (!Platform.isAndroid) return; - bool results = await SupportorPlugin.processText(); - setState(() { - supportTranslate = results; - }); - } -} diff --git a/lib/fluent/component/sort_group.dart b/lib/fluent/component/sort_group.dart deleted file mode 100644 index f7e721acc..000000000 --- a/lib/fluent/component/sort_group.dart +++ /dev/null @@ -1,59 +0,0 @@ -import 'package:fluent_ui/fluent_ui.dart'; - -class SortGroup extends StatefulWidget { - final List children; - final Function onChange; - - const SortGroup({Key? key, required this.children, required this.onChange}) - : super(key: key); - - @override - _SortGroupState createState() => _SortGroupState(); -} - -class _SortGroupState extends State { - int index = 0; - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Wrap( - spacing: 8, - children: [for (var i in widget.children) _buildChild(i)], - ); - } - - Widget _buildChild(String i) { - final text = Text( - i, - style: TextStyle( - color: index == widget.children.indexOf(i) - ? Colors.white - : FluentTheme.of(context).typography.body!.color), - ); - final onPressed = () { - int ii = widget.children.indexOf(i); - widget.onChange(ii); - if (mounted) - setState(() { - this.index = ii; - }); - }; - if (index == widget.children.indexOf(i)) - return ToggleButton( - checked: true, - child: text, - onChanged: (v) => onPressed(), - ); - else - return ToggleButton( - checked: false, - child: text, - onChanged: (v) => onPressed(), - ); - } -} diff --git a/lib/fluent/component/spotlight_card.dart b/lib/fluent/component/spotlight_card.dart deleted file mode 100644 index 7c20f7ab5..000000000 --- a/lib/fluent/component/spotlight_card.dart +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter/services.dart'; -import 'package:pixez/fluent/component/pixez_button.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/er/hoster.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/models/spotlight_response.dart'; -import 'package:pixez/fluent/page/soup/soup_page.dart'; - -class SpotlightCard extends StatelessWidget { - final SpotlightArticle spotlight; - static const platform = const MethodChannel('samples.flutter.dev/battery'); - - const SpotlightCard({Key? key, required this.spotlight}) : super(key: key); - - @override - Widget build(BuildContext context) { - return PixEzButton( - child: Container( - height: 200, - child: Card( - padding: EdgeInsets.zero, - child: Stack( - children: [ - Align( - alignment: Alignment.bottomCenter, - child: ListTile( - title: Text( - spotlight.title, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - subtitle: Text( - spotlight.pureTitle, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), - ), - Align( - alignment: Alignment.topCenter, - child: CachedNetworkImage( - imageUrl: spotlight.thumbnail, - httpHeaders: Hoster.header(url: spotlight.thumbnail), - fit: BoxFit.cover, - height: 150.0, - cacheManager: pixivCacheManager, - ), - ) - ], - ), - ), - ), - onPressed: () async { - Leader.push( - context, - SoupPage(url: spotlight.articleUrl, spotlight: spotlight), - icon: const Icon(FluentIcons.image_pixel), - title: Text("${I18n.of(context).spotlight}: ${spotlight.id}"), - ); - }, - ); - } -} diff --git a/lib/fluent/fluentui.dart b/lib/fluent/fluentui.dart deleted file mode 100644 index 9e4b85f5a..000000000 --- a/lib/fluent/fluentui.dart +++ /dev/null @@ -1,142 +0,0 @@ -import 'package:bot_toast/bot_toast.dart'; -import 'package:dynamic_color/dynamic_color.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_acrylic/flutter_acrylic.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/constants.dart'; -import 'package:pixez/fluent/page/splash/splash_page.dart'; -import 'package:pixez/fluent/platform/platform.dart'; -import 'package:pixez/main.dart'; -import 'package:sqflite_common_ffi/sqflite_ffi.dart'; -import 'package:window_manager/window_manager.dart'; - -Color? _fluentuiBgColor = null; - -initFluent(List args) async { - if (!Constants.isFluent) return; - - final dbPath = await getDBPath(); - if (dbPath != null) databaseFactory.setDatabasesPath(dbPath); - - // Must add this line. - await windowManager.ensureInitialized(); - await windowManager.waitUntilReadyToShow( - WindowOptions( - titleBarStyle: TitleBarStyle.hidden, - center: true, - skipTaskbar: false, - minimumSize: const Size(350, 600), - ), - () async { - await Window.initialize(); - - await windowManager.show(); - await windowManager.focus(); - }, - ); -} - -Future _applyEffect(bool isDark) async { - if (!Constants.isFluent) return; - - final effect = await getEffect(); - debugPrint("背景特效: $effect; 暗色主题: $isDark;"); - - if (effect != WindowEffect.disabled) - await windowManager.setBackgroundColor( - _fluentuiBgColor = Colors.transparent, - ); - - await Window.setEffect( - effect: effect, - dark: isDark, - ); -} - -Widget buildFluentUI(BuildContext context) { - if (!Constants.isFluent) return Container(); - - return DynamicColorBuilder( - builder: (lightDynamic, darkDynamic) { - return Observer(builder: (context) { - final mode = userSetting.themeMode; - final platformBrightness = MediaQuery.platformBrightnessOf(context); - final isDark = mode == ThemeMode.dark || - (mode == ThemeMode.system && platformBrightness == Brightness.dark); - - _applyEffect(isDark); - final botToastBuilder = BotToastInit(); - return FluentApp( - home: Builder(builder: (context) { - return AnnotatedRegion( - value: SystemUiOverlayStyle(statusBarColor: _fluentuiBgColor), - child: SplashPage(), - ); - }), - builder: (context, child) { - child = botToastBuilder(context, child); - return Directionality( - textDirection: TextDirection.ltr, - child: NavigationPaneTheme( - data: NavigationPaneThemeData( - backgroundColor: _fluentuiBgColor, - ), - child: child, - ), - ); - }, - title: 'PixEz', - locale: userSetting.locale, - navigatorObservers: [ - BotToastNavigatorObserver(), - routeObserver, - ], - themeMode: userSetting.themeMode, - darkTheme: FluentThemeData( - brightness: Brightness.dark, - visualDensity: VisualDensity.standard, - accentColor: darkDynamic?.primary.toAccentColor(), - focusTheme: FocusThemeData( - glowFactor: is10footScreen(context) ? 2.0 : 0.0, - ), - ), - theme: FluentThemeData( - brightness: Brightness.light, - visualDensity: VisualDensity.standard, - accentColor: lightDynamic?.primary.toAccentColor(), - focusTheme: FocusThemeData( - glowFactor: is10footScreen(context) ? 2.0 : 0.0, - ), - ), - localizationsDelegates: [ - _FluentLocalizationsDelegate(), - ...AppLocalizations.localizationsDelegates - ], - supportedLocales: AppLocalizations.supportedLocales, // Add this line - ); - }); - }, - ); -} - -class _FluentLocalizationsDelegate - extends LocalizationsDelegate { - const _FluentLocalizationsDelegate(); - - @override - bool isSupported(Locale locale) { - return AppLocalizations.supportedLocales.contains(locale); - } - - @override - Future load(Locale locale) { - return FluentLocalizations.delegate.load(locale); - } - - @override - bool shouldReload(covariant LocalizationsDelegate old) { - return false; - } -} diff --git a/lib/fluent/lighting/fluent_lighting_page.dart b/lib/fluent/lighting/fluent_lighting_page.dart deleted file mode 100644 index f5c19ffc9..000000000 --- a/lib/fluent/lighting/fluent_lighting_page.dart +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:math'; - -import 'package:easy_refresh/easy_refresh.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:mobx/mobx.dart'; -import 'package:pixez/component/pixez_default_header.dart'; -import 'package:pixez/fluent/component/illust_card.dart'; -import 'package:pixez/exts.dart'; -import 'package:pixez/utils.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/lighting/lighting_store.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/illust.dart'; -import 'package:waterfall_flow/waterfall_flow.dart'; - -class WaterFallLoading extends StatefulWidget { - const WaterFallLoading({Key? key}) : super(key: key); - - @override - State createState() => _WaterFallLoadingState(); -} - -class _WaterFallLoadingState extends State { - @override - Widget build(BuildContext context) { - return Container( - child: Center(child: ProgressRing()), - ); - } -} - -class LightingList extends StatefulWidget { - final LightSource source; - final Widget? header; - final bool? isNested; - final ScrollController? scrollController; - final String? portal; - - const LightingList( - {Key? key, - required this.source, - this.header, - this.isNested, - this.scrollController, - this.portal}) - : super(key: key); - - @override - _LightingListState createState() => _LightingListState(); -} - -class _LightingListState extends State { - late LightingStore _store; - late bool _isNested; - late ScrollController _scrollController; - - @override - void didUpdateWidget(LightingList oldWidget) { - super.didUpdateWidget(oldWidget); - if (oldWidget.source != widget.source) { - _store.source = widget.source; - _fetch(); - } - } - - _fetch() async { - await _store.fetch(force: true); - if (!_isNested && _store.errorMessage == null && !_store.iStores.isEmpty) { - _scrollController.position.jumpTo(0.0); - } - } - - ReactionDisposer? disposer; - - void Function()? _disableListener; - - @override - void initState() { - _isNested = widget.isNested ?? false; - _scrollController = widget.scrollController ?? ScrollController(); - _refreshController = EasyRefreshController( - controlFinishLoad: true, controlFinishRefresh: true); - _store = LightingStore( - widget.source, - ); - _store.easyRefreshController = _refreshController; - super.initState(); - _store.fetch(); - - // Load More Detecter - _disableListener = - initializeScrollController(_scrollController, _store.fetchNext); - } - - @override - void dispose() { - if (_disableListener != null) _disableListener!(); - if (widget.scrollController == null) { - _scrollController.dispose(); - } - _store.dispose(); - _refreshController.dispose(); - super.dispose(); - } - - bool backToTopVisible = false; - - @override - Widget build(BuildContext context) { - return Container( - child: Observer(builder: (_) { - return Container(child: _buildContent(context)); - }), - ); - } - - late EasyRefreshController _refreshController; - - Widget _buildWithoutHeader(context) { - _store.iStores.removeWhere((element) => element.illusts!.hateByUser()); - return NotificationListener( - onNotification: (ScrollNotification notification) { - if (widget.isNested == true) { - return true; - } - ScrollMetrics metrics = notification.metrics; - if (backToTopVisible == metrics.atEdge && mounted) { - setState(() { - backToTopVisible = !backToTopVisible; - }); - } - return true; - }, - child: EasyRefresh.builder( - controller: _refreshController, - header: PixezDefault.header(context), - scrollController: _scrollController, - onRefresh: () { - _store.fetch(force: true); - }, - onLoad: () { - _store.fetchNext(); - }, - childBuilder: (context, physics) => WaterfallFlow.builder( - physics: physics, - controller: widget.isNested ?? false ? null : _scrollController, - padding: EdgeInsets.all(5.0), - itemCount: _store.iStores.length, - itemBuilder: (context, index) { - return _buildItem(index); - }, - gridDelegate: _buildGridDelegate(), - ), - )); - } - - bool needToBan(Illusts illust) { - for (var i in muteStore.banillusts) { - if (i.illustId == illust.id.toString()) return true; - } - for (var j in muteStore.banUserIds) { - if (j.userId == illust.user.id.toString()) return true; - } - for (var t in muteStore.banTags) { - for (var f in illust.tags) { - if (f.name == t.name) return true; - } - } - return false; - } - - Widget _buildContent(context) { - return _store.errorMessage != null - ? _buildErrorContent(context) - : _store.iStores.isNotEmpty - ? (widget.header != null - ? _buildWithHeader(context) - : _buildWithoutHeader(context)) - : Container( - child: _store.refreshing ? WaterFallLoading() : Container(), - ); - } - - Container _buildErrorContent(context) { - return Container( - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - height: 50, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: - Text(':(', style: FluentTheme.of(context).typography.subtitle), - ), - Button( - onPressed: () { - _store.fetch(force: true); - }, - child: Text(I18n.of(context).retry)), - Padding( - padding: const EdgeInsets.all(16.0), - child: Text( - (_store.errorMessage?.contains("400") == true - ? '${I18n.of(context).error_400_hint}\n ${_store.errorMessage}' - : '${_store.errorMessage}'), - )) - ], - ), - ); - } - - Widget _buildWithHeader(BuildContext context) { - return NotificationListener( - onNotification: (ScrollNotification notification) { - ScrollMetrics metrics = notification.metrics; - if (backToTopVisible == metrics.atEdge && mounted) { - setState(() { - backToTopVisible = !backToTopVisible; - }); - } - return true; - }, - child: EasyRefresh.builder( - controller: _refreshController, - scrollController: _scrollController, - header: PixezDefault.header(context), - onRefresh: () { - _store.fetch(force: true); - }, - onLoad: () { - _store.fetchNext(); - }, - childBuilder: ((context, physics) { - return CustomScrollView( - physics: physics, - controller: widget.isNested ?? false ? null : _scrollController, - slivers: [ - SliverToBoxAdapter( - child: Container(child: widget.header), - ), - SliverWaterfallFlow( - gridDelegate: _buildGridDelegate(), - delegate: _buildSliverChildBuilderDelegate(context), - ) - ], - ); - }), - ), - ); - } - - SliverChildBuilderDelegate _buildSliverChildBuilderDelegate( - BuildContext context) { - _store.iStores.removeWhere((element) => element.illusts!.hateByUser()); - return SliverChildBuilderDelegate((BuildContext context, int index) { - return IllustCard( - store: _store.iStores[index], - lightingStore: _store, - iStores: _store.iStores, - ); - }, childCount: _store.iStores.length); - } - - SliverWaterfallFlowDelegate _buildGridDelegate() { - var count = 2; - if (userSetting.crossAdapt) { - count = _buildSliderValue(); - } else { - count = (MediaQuery.of(context).orientation == Orientation.portrait) - ? userSetting.crossCount - : userSetting.hCrossCount; - } - return SliverWaterfallFlowDelegateWithFixedCrossAxisCount( - crossAxisCount: count, - ); - } - - int _buildSliderValue() { - final currentValue = - (MediaQuery.of(context).orientation == Orientation.portrait - ? userSetting.crossAdapterWidth - : userSetting.hCrossAdapterWidth) - .toDouble(); - var nowAdaptWidth = max(currentValue, 50.0); - nowAdaptWidth = min(nowAdaptWidth, 2160.0); - final screenWidth = MediaQuery.of(context).size.width; - final result = max(screenWidth / nowAdaptWidth, 1.0).toInt(); - return result; - } - - Widget _buildItem(int index) { - return IllustCard( - store: _store.iStores[index], - lightingStore: _store, - iStores: _store.iStores, - ); - } -} diff --git a/lib/fluent/page/Init/guide_page.dart b/lib/fluent/page/Init/guide_page.dart deleted file mode 100644 index 3b032acf4..000000000 --- a/lib/fluent/page/Init/guide_page.dart +++ /dev/null @@ -1,111 +0,0 @@ -import 'dart:io'; - -import 'package:animations/animations.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/network/api_client.dart'; -import 'package:pixez/page/about/languages.dart'; -import 'package:pixez/fluent/page/Init/init_page.dart'; -import 'package:pixez/fluent/page/network/network_page.dart'; -import 'package:shared_preferences/shared_preferences.dart'; - -class GuidePage extends StatefulWidget { - @override - _GuidePageState createState() => _GuidePageState(); -} - -class _GuidePageState extends State { - late List _pageList; - int index = 0; - bool isNext = true; - - @override - void initState() { - _pageList = [InitPage(), NetworkPage()]; - super.initState(); - } - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - content: SafeArea( - child: Column( - children: [ - Expanded( - child: PageTransitionSwitcher( - duration: const Duration(milliseconds: 300), - reverse: !isNext, - transitionBuilder: ( - Widget child, - Animation animation, - Animation secondaryAnimation, - ) { - return SharedAxisTransition( - child: child, - animation: animation, - secondaryAnimation: secondaryAnimation, - transitionType: SharedAxisTransitionType.horizontal, - ); - }, - child: _pageList[index], - ), - ), - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 15.0, vertical: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AnimatedOpacity( - duration: Duration(milliseconds: 300), - opacity: index == 0 ? 0 : 1, - child: HyperlinkButton( - onPressed: () { - int backValue = index - 1; - if (backValue == 1 || backValue == 0) { - setState(() { - index = backValue; - isNext = false; - }); - } - }, - child: const Text('BACK'), - ), - ), - FilledButton( - onPressed: () async { - int nextValue = index + 1; - if (nextValue == 1) { - var prefs = await SharedPreferences.getInstance(); - await prefs.setInt( - 'language_num', userSetting.languageNum); - //有可能用户啥都没选 - final languageList = - Languages.map((e) => e.language).toList(); - ApiClient.Accept_Language = - languageList[userSetting.languageNum]; - apiClient.httpClient.options - .headers[HttpHeaders.acceptLanguageHeader] = - ApiClient.Accept_Language; - setState(() { - index = nextValue; - isNext = true; - }); - } else if (nextValue == 2) { - var prefs = await SharedPreferences.getInstance(); - await prefs.setBool('guide_enable', false); - Leader.pushUntilHome(context); - } - }, - child: const Text('NEXT'), - ), - ], - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/fluent/page/Init/init_page.dart b/lib/fluent/page/Init/init_page.dart deleted file mode 100644 index e227a9db7..000000000 --- a/lib/fluent/page/Init/init_page.dart +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/page/about/languages.dart'; - -class InitPage extends StatefulWidget { - @override - _InitPageState createState() => _InitPageState(); -} - -class _InitPageState extends State { - final languageList = Languages.map((e) => e.language).toList(); - var currentIndex = 0; - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - content: Container( - child: Center( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - I18n.of(context).select_language, - style: FluentTheme.of(context).typography.title, - textAlign: TextAlign.center, - ), - ), - Padding( - padding: const EdgeInsets.all(32.0), - child: Center( - child: Text("Select Language\n语言选择\n語言選擇\n言語を選択してください"), - ), - ), - ComboBox( - value: userSetting.languageNum, - onChanged: (i) async { - await userSetting.setLanguageNum(i ?? 0); - setState(() {}); - }, - items: [ - for (int i = 0; i < languageList.length; i++) - ComboBoxItem( - child: Text(languageList[i]), - value: i, - ) - ], - ), - ], - ), - ), - ), - ); - } -} diff --git a/lib/fluent/page/about/about_page.dart b/lib/fluent/page/about/about_page.dart deleted file mode 100644 index 05b36acbc..000000000 --- a/lib/fluent/page/about/about_page.dart +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:async'; -import 'dart:io'; - -import 'package:bot_toast/bot_toast.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:in_app_purchase/in_app_purchase.dart'; -import 'package:in_app_purchase_storekit/store_kit_wrappers.dart'; -import 'package:pixez/fluent/component/new_version_chip.dart'; -import 'package:pixez/constants.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/page/about/contributors.dart'; -import 'package:pixez/fluent/page/about/thanks_list.dart'; -import 'package:pixez/fluent/page/about/update_page.dart'; -import 'package:share_plus/share_plus.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class AboutPage extends StatefulWidget { - final bool? newVersion; - - const AboutPage({Key? key, this.newVersion}) : super(key: key); - - @override - _AboutPageState createState() => _AboutPageState(); -} - -class _AboutPageState extends State { - late bool hasNewVersion; - StreamSubscription>? _subscription; - List products = []; - - @override - void initState() { - initIap(); - hasNewVersion = widget.newVersion ?? false; - super.initState(); - } - - initIap() async { - if (!Constants.isGooglePlay && !Platform.isIOS) return; - final Stream purchaseUpdated = InAppPurchase.instance.purchaseStream; - _subscription = purchaseUpdated.listen((purchaseDetailsList) { - _listenToPurchaseUpdated(purchaseDetailsList); - }, onDone: () { - _subscription?.cancel(); - }, onError: (error) {}) as StreamSubscription>?; - const Set _kIds = {'support', 'support1'}; - final ProductDetailsResponse response = - await InAppPurchase.instance.queryProductDetails(_kIds); - if (response.notFoundIDs.isNotEmpty) {} - List pDetails = response.productDetails; - products.clear(); - products.addAll(pDetails); - if (Platform.isIOS && products.isNotEmpty) { - try { - var transactions = await SKPaymentQueueWrapper().transactions(); - transactions.forEach((skPaymentTransactionWrapper) { - SKPaymentQueueWrapper() - .finishTransaction(skPaymentTransactionWrapper); - }); - } catch (e) {} - } - } - - void _listenToPurchaseUpdated(List purchaseDetailsList) { - purchaseDetailsList.forEach((PurchaseDetails purchaseDetails) async { - if (purchaseDetails.status == PurchaseStatus.pending) { - } else { - if (purchaseDetails.status == PurchaseStatus.error) { - } else if (purchaseDetails.status == PurchaseStatus.purchased || - purchaseDetails.status == PurchaseStatus.restored) { - BotToast.showText(text: "Thanks"); - } - if (purchaseDetails.pendingCompletePurchase) { - await InAppPurchase.instance.completePurchase(purchaseDetails); - } - } - }); - } - - @override - void dispose() { - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader( - title: Text(I18n.of(context).about), - ), - content: _buildInfo(context), - ); - } - - Widget _buildInfo(BuildContext context) { - return Observer(builder: (context) { - return ListView( - children: [ - ListTile( - leading: CircleAvatar( - backgroundImage: AssetImage('assets/images/me.jpg'), - ), - title: Text('Perol_Notsfsssf'), - subtitle: Text(I18n.of(context).perol_message), - onPressed: () { - showDialog( - context: context, - barrierDismissible: true, - builder: (context) => Padding( - padding: EdgeInsets.all(128), - child: IconButton( - onPressed: () async { - if (Platform.isAndroid) - await launchUrl(Uri.parse(Constants.isGooglePlay - ? "https://music.youtube.com/watch?v=qfDhiBUNzwA&feature=share" - : "https://music.apple.com/cn/album/intrauterine-education-single/1515096587")); - }, - icon: Container( - child: Image.asset( - 'assets/images/liz.png', - fit: BoxFit.cover, - ), - ), - ), - ), - ); - }, - ), - ListTile( - leading: CircleAvatar( - backgroundImage: AssetImage('assets/images/right_now.jpg'), - ), - title: Text('Right now'), - subtitle: Text(I18n.of(context).right_now_message), - onPressed: () { - showDialog( - context: context, - barrierDismissible: true, - builder: (context) => Container( - height: 200.0, - child: Center( - child: Text("这里空空的,这个设计师显然没有什么话要说"), - ), - ), - ); - }, - ), - Padding( - padding: const EdgeInsets.all(16.0), - child: Text('Contributors'), - ), - Container( - height: 162, - child: ListView.builder( - shrinkWrap: true, - itemCount: contributors.length, - scrollDirection: Axis.horizontal, - padding: EdgeInsets.only(left: 4.0), - itemBuilder: (context, index) { - final data = contributors[index]; - return Container( - margin: EdgeInsets.only(left: 4.0, top: 4.0, bottom: 4.0), - child: IconButton( - onPressed: () async { - try { - if (data.onPressed == null) return; - await data.onPressed!(context); - } catch (e) {} - }, - icon: Container( - width: 80, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - children: [ - Container( - height: 8, - ), - CircleAvatar( - backgroundImage: NetworkImage( - data.avatar, - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - data.name, - textAlign: TextAlign.center, - ), - ), - ], - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - data.content, - textAlign: TextAlign.center, - ), - ) - ], - ), - ), - ), - ); - }, - ), - ), - ListTile( - leading: Icon(FluentIcons.rate), - title: Text(I18n.of(context).rate_title), - subtitle: Text(I18n.of(context).rate_message), - onPressed: () async { - if (Platform.isIOS) { - var url = 'https://apps.apple.com/cn/app/pixez/id1494435126'; - try { - await launchUrl(Uri.parse(url)); - } catch (e) {} - } - }, - ), - if (Platform.isAndroid) ...[ - ListTile( - leading: Icon(FluentIcons.device_off), - title: Text(I18n.of(context).repo_address), - subtitle: Text('github.com/Notsfsssf/pixez-flutter'), - trailing: Visibility( - child: NewVersionChip(), - visible: hasNewVersion, - ), - onPressed: () { - if (!Constants.isGooglePlay) - showDialog( - context: context, - builder: (_) { - return SafeArea( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - ListTile( - title: Text('Version ${Constants.tagName}'), - subtitle: Text( - I18n.of(context).go_to_project_address), - onPressed: () async { - try { - await launchUrl(Uri.parse( - 'https://github.com/Notsfsssf/pixez-flutter')); - } catch (e) {} - }, - trailing: IconButton( - icon: Icon(FluentIcons.link), - onPressed: () async { - try { - await launchUrl(Uri.parse( - 'https://github.com/Notsfsssf/pixez-flutter')); - } catch (e) {} - }), - ), - ListTile( - title: Text(I18n.of(context).check_for_updates), - onPressed: () { - Leader.push( - context, - UpdatePage(), - icon: Icon(FluentIcons.update_restore), - title: Text( - I18n.of(context).check_for_updates), - ); - }, - trailing: Icon(FluentIcons.update_restore), - ), - ListTile( - leading: CircleAvatar( - backgroundImage: NetworkImage( - 'https://avatars1.githubusercontent.com/u/9017470?s=400&v=4'), - ), - title: Text('Skimige'), - subtitle: - Text(I18n.of(context).skimige_message), - ), - ], - ), - ); - }); - }, - ) - ], - Visibility( - visible: false, - child: ListTile( - leading: Icon(FluentIcons.home), - title: Text('GitHub Page'), - subtitle: Text('https://github.com/Notsfsssf'), - onPressed: () async {}), - ), - ListTile( - leading: Icon(FluentIcons.mail), - title: Text(I18n.of(context).feedback), - subtitle: Text('PxezFeedBack@outlook.com'), - ), - ListTile( - leading: Icon(FluentIcons.like), - title: Text(I18n.of(context).support), - subtitle: Text(I18n.of(context).support_message), - ), - ListTile( - leading: Icon(FluentIcons.favorite_star), - title: Text(I18n.of(context).thanks), - subtitle: Text('感谢帮助我测试的弹幕委员会群友们\n感谢pixiv cat站主提供的图床'), - onPressed: () { - Leader.push( - context, - ScaffoldPage(content: ThanksList()), - icon: Icon(FluentIcons.favorite_star), - title: Text(I18n.of(context).thanks), - ); - }, - ), - ListTile( - leading: Icon(FluentIcons.share), - title: Text(I18n.of(context).share), - subtitle: Text(I18n.of(context).share_this_app_link), - onPressed: () { - if (Platform.isIOS) { - Share.share('https://apps.apple.com/cn/app/pixez/id1494435126'); - } - }, - ), - ListTile( - leading: Icon(FontAwesomeIcons.telegram), - title: Text("Group"), - subtitle: Text('t.me/PixEzChannel'), - ), - if (Platform.isAndroid && !Constants.isGooglePlay) ...[ - ListTile( - title: Text(I18n.of(context).donate_title), - subtitle: Text(I18n.of(context).donate_message), - ), - Card( - child: ListTile( - title: Text('AliPay'), - subtitle: Text('912756674@qq.com'), - onPressed: () async {}, - ), - ), - Card( - child: ListTile( - title: Text('Wechat Pay'), - subtitle: Text('tap'), - onPressed: () async { - showDialog( - context: context, - builder: (_) { - return ContentDialog( - content: Image.asset( - 'assets/images/weixin_qr.png', - width: 300, - height: 300, - ), - ); - }); - }, - ), - ), - ], - if (Platform.isIOS) ...[ - Card( - child: ListTile( - subtitle: Text('如果你觉得这个应用还不错,支持一下开发者吧!'), - title: Text('支持开发者工作'), - trailing: Text('12¥'), - onPressed: () async { - BotToast.showText(text: 'try to Purchase'); - for (var p in products) { - if (p.id == "support") { - final PurchaseParam purchaseParam = - PurchaseParam(productDetails: p); - InAppPurchase.instance - .buyConsumable(purchaseParam: purchaseParam); - break; - } - } - }, - ), - ), - Card( - child: ListTile( - subtitle: Text('如果你觉得这个应用非常不错,支持一下开发者吧!'), - title: Text('支持开发者工作'), - trailing: Text('25¥'), - onPressed: () async { - BotToast.showText(text: 'try to Purchase'); - for (var p in products) { - if (p.id == "support1") { - final PurchaseParam purchaseParam = - PurchaseParam(productDetails: p); - InAppPurchase.instance - .buyConsumable(purchaseParam: purchaseParam); - break; - } - } - }, - ), - ), - ], - if (!Platform.isIOS && products.isNotEmpty && Constants.isGooglePlay) - for (var i in products) - Card( - margin: EdgeInsets.all(8.0), - child: ListTile( - leading: Icon(FontAwesomeIcons.mugSaucer), - title: Text(i.description), - subtitle: Text(i.price), - onPressed: () { - BotToast.showText(text: 'try to Purchase'); - final PurchaseParam purchaseParam = - PurchaseParam(productDetails: i); - InAppPurchase.instance - .buyConsumable(purchaseParam: purchaseParam); - }, - ), - ) - ], - ); - }); - } -} diff --git a/lib/fluent/page/about/thanks_list.dart b/lib/fluent/page/about/thanks_list.dart deleted file mode 100644 index 44488b736..000000000 --- a/lib/fluent/page/about/thanks_list.dart +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/page/about/thanks_peoples.dart'; - -class ThanksList extends StatelessWidget { - - @override - Widget build(BuildContext context) { - return ListView( - children: [ - ListTile( - title: Text( - ' 一路做到现在的flutter版也过了好久了,虽然多次下架,版本包名甚至名称多次变更,但是在这些时间里,我得到了很多人的帮助,支持与鼓励,积累了许多开发经验还有社会教训,还能够有机会与想法出色、技术出众、审美出彩的用户、开发者、设计师交流,还可以顺便安利自己喜欢的歌曲,真是太棒了,非常感谢你们的支持:'), - ), - Divider(), - ...peoples.map((e) => ListTile( - title: Text(e), - )), - ], - ); - } -} diff --git a/lib/fluent/page/about/update_page.dart b/lib/fluent/page/about/update_page.dart deleted file mode 100644 index d80aa9e88..000000000 --- a/lib/fluent/page/about/update_page.dart +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:dio/dio.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/page/about/last_release.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class UpdatePage extends StatefulWidget { - @override - _UpdatePageState createState() => _UpdatePageState(); -} - -class _UpdatePageState extends State { - Dio _dio = Dio(); - - @override - void initState() { - super.initState(); - initData(); - } - - LastRelease? lastRelease; - dynamic error; - - initData() async { - try { - Response response = await _dio.get( - 'https://api.github.com/repos/Notsfsssf/pixez-flutter/releases/latest'); - final result = LastRelease.fromJson(response.data); - setState(() { - lastRelease = result; - }); - } catch (e) { - setState(() { - error = e; - }); - } - } - - @override - Widget build(BuildContext context) { - return SelectionArea( - child: ScaffoldPage( - header: PageHeader( - title: Text(I18n.of(context).update), - commandBar: CommandBar(primaryItems: [ - CommandBarButton( - onPressed: () { - setState(() { - error = null; - lastRelease = null; - }); - initData(); - }, - icon: Icon(FluentIcons.refresh), - label: Text(I18n.of(context).refresh)) - ]), - ), - content: lastRelease == null - ? Builder(builder: (_) { - return error == null - ? Container( - child: Center( - child: ProgressRing(), - ), - ) - : Container( - child: Center( - child: Text(error.toString()), - ), - ); - }) - : ListView( - children: [ - ListTile( - title: Text(I18n.of(context).latest_version), - subtitle: Text(lastRelease!.tagName), - ), - ListTile( - title: Text(I18n.of(context).download_address), - subtitle: SelectableText( - lastRelease!.assets.first.browserDownloadUrl), - onPressed: () async { - try { - await launchUrl(Uri.parse( - lastRelease!.assets.first.browserDownloadUrl)); - } catch (e) {} - }, - ), - ListTile( - title: - Text(I18n.of(context).new_version_update_information), - subtitle: Text(lastRelease!.body), - ) - ], - ), - ), - ); - } -} diff --git a/lib/fluent/page/account/edit/account_edit_page.dart b/lib/fluent/page/account/edit/account_edit_page.dart deleted file mode 100644 index 411e20423..000000000 --- a/lib/fluent/page/account/edit/account_edit_page.dart +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:bot_toast/bot_toast.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter/services.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/page/account/edit/account_edit_store.dart'; -import 'package:pixez/fluent/page/webview/account_deletion_webview_page.dart'; - -class AccountEditPage extends StatefulWidget { - @override - _AccountEditPageState createState() => _AccountEditPageState(); -} - -class _AccountEditPageState extends State { - late TextEditingController _passwordController, - _oldPasswordController, - _emailController, - _accountController; - AccountEditStore _accountEditStore = AccountEditStore(); - - @override - void initState() { - _passwordController = TextEditingController(); - _emailController = TextEditingController(); - _accountController = TextEditingController(); - _oldPasswordController = TextEditingController(); - if (accountStore.now != null) { - if (accountStore.now!.isMailAuthorized != 1) { - _oldPasswordController.text = accountStore.now!.passWord; - } - _accountController.text = accountStore.now!.account; - _emailController.text = accountStore.now!.mailAddress; - } - - super.initState(); - } - - @override - Widget build(BuildContext context) { - return ContentDialog( - title: Text(I18n.of(context).account_message), - content: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 4.0) - .copyWith(top: 0, bottom: 4.0), - child: InfoLabel( - label: 'Account', - child: TextBox( - controller: _accountController, - enabled: false, - placeholder: 'Account', - ), - ), - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0), - child: InfoLabel( - label: I18n.of(context).current_password, - child: PasswordBox( - controller: _oldPasswordController, - placeholder: I18n.of(context).current_password, - ), - ), - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0), - child: InfoLabel( - label: I18n.of(context).new_password, - child: PasswordBox( - controller: _passwordController, - placeholder: I18n.of(context).new_password, - ), - ), - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0), - child: InfoLabel( - label: 'Email', - child: TextBox( - controller: _emailController, - placeholder: 'Email', - ), - ), - ), - if (accountStore.now != null && - accountStore.now!.isMailAuthorized == 1) - ListTile( - onPressed: () async { - Clipboard.setData( - ClipboardData(text: accountStore.now!.refreshToken)); - BotToast.showText(text: "Copied to clipboard"); - }, - title: Text("Token export"), - ), - ListTile( - title: Text(I18n.of(context).account_deletion), - trailing: Icon(FluentIcons.open_in_new_window), - onPressed: () => showDialog( - context: context, - useRootNavigator: false, - builder: (ctx) { - return ContentDialog( - title: Text("${I18n.of(ctx).account_deletion}?"), - content: Text("${I18n.of(ctx).account_deletion_subtitle}"), - actions: [ - Button( - onPressed: () { - Navigator.of(ctx).pop(); - }, - child: Text(I18n.of(ctx).cancel), - ), - FilledButton( - onPressed: () async { - Navigator.of(ctx).pop(); - await accountStore.deleteAll(); - await Leader.push( - context, - AccountDeletionPage(), - icon: Icon(FluentIcons.account_management), - title: Text(I18n.of(context).account_deletion), - ); - Navigator.of(context).pop(); - }, - child: Text(I18n.of(ctx).ok), - ), - ], - ); - }, - ), - ), - ], - ), - actions: [ - Button( - child: Text(I18n.of(context).cancel), - onPressed: () => Navigator.of(context).pop(), - ), - FilledButton( - child: Text(I18n.of(context).save), - onPressed: () async { - if (_oldPasswordController.text.isEmpty || - _emailController.text.isEmpty) { - Navigator.of(context).pop(); - return; - } - if (_emailController.text.isNotEmpty && - !_emailController.text.contains('@')) { - BotToast.showCustomText( - toastBuilder: (_) => Align( - alignment: Alignment(0, 0.8), - child: Card( - child: ListTile( - leading: Icon(FluentIcons.error), - title: Text("Email format error")), - ), - ), - ); - Navigator.of(context).pop(); - return; - } - bool success = await _accountEditStore.fetch( - (_emailController.value.text.isEmpty - ? null - : _emailController.value.text)!, - _passwordController.value.text.isEmpty - ? null - : _passwordController.value.text, - _oldPasswordController.value.text, - null); - if (success) { - if (accountStore.now != null) { - if (_passwordController.text.isNotEmpty) { - accountStore.now!.passWord = _passwordController.text; - } - if (_emailController.text.isNotEmpty) { - accountStore.now!.mailAddress = _emailController.text; - } - accountStore.updateSingle(accountStore.now!); - } - } else { - displayInfoBar(context, - builder: (context, VoidCallback) => InfoBar( - title: Text('Error'), - content: Text('${_accountEditStore.errorString}'), - )); - } - Navigator.of(context).pop(); - }, - ), - ], - ); - } -} diff --git a/lib/fluent/page/account/select/account_select_page.dart b/lib/fluent/page/account/select/account_select_page.dart deleted file mode 100644 index 440621336..000000000 --- a/lib/fluent/page/account/select/account_select_page.dart +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/fluent/component/painter_avatar.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/account.dart'; -import 'package:pixez/fluent/page/login/login_page.dart'; - -class AccountSelectPage extends StatefulWidget { - @override - _AccountSelectPageState createState() => _AccountSelectPageState(); -} - -class _AccountSelectPageState extends State { - @override - void initState() { - accountStore.fetch(); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Observer(builder: (context) { - return ContentDialog( - content: ListView.builder( - itemBuilder: (context, index) { - AccountPersist accountPersist = accountStore.accounts[index]; - return ListTile( - leading: PainterAvatar( - url: accountStore.accounts[index].userImage, - id: int.parse(accountStore.accounts[index].userId), - ), - title: Text(accountPersist.name), - subtitle: Text(accountPersist.mailAddress), - trailing: accountStore.accounts.indexOf(accountStore.now) == index - ? Icon(FluentIcons.check_mark) - : IconButton( - icon: Icon(FluentIcons.delete), - onPressed: () { - accountStore.deleteSingle(accountPersist.id!); - }, - ), - onPressed: () async { - if (accountStore.accounts.indexOf(accountStore.now) != index) { - await accountStore.select(index); - setState(() {}); - } - }, - ); - }, - itemCount: accountStore.accounts.length, - ), - title: PageHeader( - title: Text(I18n.of(context).account_change), - commandBar: CommandBar( - mainAxisAlignment: MainAxisAlignment.end, - primaryItems: [ - CommandBarButton( - icon: Icon(FluentIcons.add), - onPressed: () => Leader.push( - context, - LoginPage(), - icon: Icon(FluentIcons.add), - title: Text(I18n.of(context).login), - ), - ) - ]), - ), - actions: [ - FilledButton( - child: Text(I18n.of(context).ok), - onPressed: () => Navigator.of(context).pop(), - ), - ], - ); - }); - } -} diff --git a/lib/fluent/page/book/tag/book_tag_page.dart b/lib/fluent/page/book/tag/book_tag_page.dart deleted file mode 100644 index 153884f1b..000000000 --- a/lib/fluent/page/book/tag/book_tag_page.dart +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -import 'dart:collection'; - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/fluent/page/search/result_illust_list.dart'; - -class BookTagPage extends StatefulWidget { - @override - _BookTagPageState createState() => _BookTagPageState(); -} - -class _BookTagPageState extends State - with TickerProviderStateMixin { - int _index = 0; - late Map _tags; - - @override - Widget build(BuildContext context) { - return Observer(builder: (_) { - return NavigationView( - pane: NavigationPane( - selected: _index, - onChanged: (value) => setState(() { - _index = value; - }), - items: [ - for (var i in bookTagStore.bookTagList) - PaneItem( - icon: Icon(FluentIcons.tag), - body: ResultIllustList(word: i), - title: Text(i), - ) - ], - footerItems: [ - PaneItemAction( - icon: Icon(FluentIcons.edit), - onTap: () => _showEditDialog(context), - ), - ], - displayMode: PaneDisplayMode.top, - ), - ); - }); - } - - void _showEditDialog(BuildContext context) { - _tags = HashMap.fromEntries( - bookTagStore.bookTagList.map((i) => MapEntry(i, true)), - ); - - showDialog( - context: context, - useRootNavigator: false, - builder: (context) => ContentDialog( - title: Text(I18n.of(context).choice_you_like), - content: _buildTagChip(), - actions: [ - Button( - child: Text(I18n.of(context).cancel), - onPressed: Navigator.of(context).pop, - ), - FilledButton( - child: Text(I18n.of(context).ok), - onPressed: () { - _tags.entries - .where((i) => !i.value) - .map((i) => i.key) - .forEach(bookTagStore.unBookTag); - Navigator.of(context).pop(); - }, - ), - ], - ), - ); - } - - Widget _buildTagChip() { - return StatefulBuilder( - builder: (context, setState) => SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - for (var i in _tags.entries) - Padding( - padding: const EdgeInsets.all(2.0), - child: Checkbox( - content: Text(i.key), - checked: i.value, - onChanged: (v) => setState(() { - _tags[i.key] = v ?? false; - }), - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/fluent/page/comment/comment_page.dart b/lib/fluent/page/comment/comment_page.dart deleted file mode 100644 index 647b798ac..000000000 --- a/lib/fluent/page/comment/comment_page.dart +++ /dev/null @@ -1,474 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:bot_toast/bot_toast.dart'; -import 'package:easy_refresh/easy_refresh.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/component/comment_emoji_text.dart'; -import 'package:pixez/component/pixez_default_header.dart'; -import 'package:pixez/fluent/component/painter_avatar.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/exts.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/comment_response.dart'; -import 'package:pixez/network/api_client.dart'; -import 'package:pixez/page/comment/comment_page.dart'; -import 'package:pixez/page/comment/comment_store.dart'; -import 'package:pixez/fluent/page/report/report_items_page.dart'; - -class CommentPage extends StatefulWidget { - final int id; - final bool isReplay; - final int? pId; - final String? name; - final CommentArtWorkType type; - - const CommentPage( - {Key? key, - required this.id, - this.isReplay = false, - this.pId, - this.name, - this.type = CommentArtWorkType.ILLUST}) - : super(key: key); - - @override - _CommentPageState createState() => _CommentPageState(); -} - -class _CommentPageState extends State { - late TextEditingController _editController; - int? parentCommentId; - String? parentCommentName; - late EasyRefreshController easyRefreshController; - late CommentStore _store; - - List banList = [ - "bb8.news", - "77k.live", - "7mm.live", - "p26w.com", - "33h.live" - ]; - - @override - void initState() { - parentCommentId = widget.isReplay ? widget.pId : null; - parentCommentName = widget.isReplay ? widget.name : null; - _editController = TextEditingController(); - easyRefreshController = EasyRefreshController( - controlFinishLoad: true, controlFinishRefresh: true); - _store = CommentStore(easyRefreshController, widget.id, widget.pId, - widget.isReplay, widget.type) - ..fetch(); - super.initState(); - } - - @override - void dispose() { - _editController.dispose(); - easyRefreshController.dispose(); - super.dispose(); - } - - bool _emojiPanelShow = false; - - Widget _buildEmojiPanel(BuildContext context) { - return Container( - height: 200, - child: GridView.count( - crossAxisCount: 5, - children: [ - for (var i in emojisMap.keys) - Padding( - padding: const EdgeInsets.all(4.0), - child: IconButton( - onPressed: () { - String key = i; - String text = _editController.text; - TextSelection textSelection = _editController.selection; - if (!textSelection.isValid) { - _editController.text = "${_editController.text}${key}"; - return; - } - String newText = text.replaceRange( - textSelection.start, textSelection.end, key); - final emojiLength = key.length; - _editController.text = newText; - _editController.selection = textSelection.copyWith( - baseOffset: textSelection.start + emojiLength, - extentOffset: textSelection.start + emojiLength, - ); - }, - icon: Image.asset( - 'assets/emojis/${emojisMap[i]}', - width: 32, - height: 32, - ), - ), - ) - ], - ), - ); - } - - bool commentHateByUser(Comment comment) { - for (var i in muteStore.banComments) { - if (i.commentId == comment.id.toString()) { - return true; - } - } - for (var i in muteStore.banUserIds) { - if (i.userId == comment.user?.id?.toString()) { - return true; - } - } - return false; - } - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader( - title: Text(I18n.of(context).view_comment), - ), - content: SafeArea( - child: Column( - children: [ - Expanded( - child: EasyRefresh( - header: PixezDefault.header(context), - controller: easyRefreshController, - onRefresh: () => _store.fetch(), - onLoad: () => _store.next(), - child: Observer( - builder: (context) { - if (_store.errorMessage != null) { - return Container( - child: Center( - child: Text(_store.errorMessage!), - ), - ); - } - if (_store.isEmpty) { - return Container( - child: Center( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text('[ ]', - style: - FluentTheme.of(context).typography.title), - ), - ), - ); - } - var comments = _store.comments - .where((element) => !commentHateByUser(element)) - .toList(); - return comments.isNotEmpty - ? ListView.separated( - itemCount: comments.length, - padding: EdgeInsets.only(top: 10), - itemBuilder: (context, index) { - if (banList - .where((element) => comments[index] - .comment! - .contains(element)) - .isNotEmpty) - return Visibility( - visible: false, - child: Container(), - ); - var comment = comments[index]; - return Container( - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: PainterAvatar( - url: comments[index] - .user! - .profileImageUrls - .medium, - id: comments[index].user!.id!, - ), - ), - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - comment.user!.name, - maxLines: 1, - style: TextStyle( - color: - FluentTheme.of(context) - .accentColor, - overflow: - TextOverflow.ellipsis), - ), - _buildTrailingRow( - comment, context) - ], - ), - if (comment.parentComment?.user != - null) - Text( - 'To ${comment.parentComment!.user!.name}'), - if (comment.stamp == null) - Padding( - padding: const EdgeInsets.only( - right: 4.0), - child: CommentEmojiText( - text: comment.comment ?? "", - ), - ), - if (comment.stamp != null) - Padding( - padding: const EdgeInsets.only( - right: 4.0), - child: PixivImage( - comment.stamp!.stamp_url!, - height: 100, - width: 100, - ), - ), - if (comment.hasReplies == true) - Padding( - padding: const EdgeInsets.only( - right: 4.0), - child: Button( - child: Text(I18n.of(context) - .view_replies), - onPressed: () async { - Leader.push( - context, - CommentPage( - id: widget.id, - isReplay: true, - pId: comment.id!, - type: widget.type, - name: comment.user!.name, - ), - icon: Icon( - FluentIcons.comment), - title: Text(I18n.of(context) - .view_comment), - ); - }, - ), - ), - Padding( - padding: - const EdgeInsets.only(top: 8.0), - child: Text( - comment.date - .toString() - .toShortTime(), - style: FluentTheme.of(context) - .typography - .caption, - ), - ) - ], - ), - ) - ], - ), - ); - }, - separatorBuilder: - (BuildContext context, int index) { - if (banList - .where((element) => comments[index] - .comment! - .contains(element)) - .isNotEmpty) - return Visibility( - visible: false, - child: Container(), - ); - return Padding( - padding: - const EdgeInsets.symmetric(horizontal: 8.0), - child: Divider(), - ); - }, - ) - : Container( - child: Center( - child: ProgressRing(), - ), - ); - }, - ), - ), - ), - Align( - alignment: Alignment.bottomCenter, - child: Column( - children: [ - Container( - color: FluentTheme.of(context).scaffoldBackgroundColor, - child: Row( - children: [ - IconButton( - icon: Icon(FluentIcons.book_answers), - onPressed: () { - if (widget.isReplay) return; - setState(() { - parentCommentName = null; - parentCommentId = null; - }); - }, - ), - IconButton( - icon: Icon(FluentIcons.emoji), - onPressed: () { - setState(() { - _emojiPanelShow = !_emojiPanelShow; - if (_emojiPanelShow) { - FocusScope.of(context).unfocus(); - } - }); - }, - ), - Expanded( - child: Padding( - padding: const EdgeInsets.only( - bottom: 2.0, right: 8.0), - child: InfoLabel( - label: - "Reply to ${parentCommentName == null ? "illust" : parentCommentName}", - child: TextBox( - controller: _editController, - suffix: IconButton( - icon: Icon( - FluentIcons.reply, - ), - onPressed: () async { - final client = apiClient; - String txt = - _editController.text.trim(); - final fun1 = BotToast.showLoading(); - try { - if (txt.isNotEmpty) { - if (banList - .where((element) => - txt.contains(element)) - .isEmpty) if (widget - .type == - CommentArtWorkType.ILLUST) - await client.postIllustComment( - widget.id, txt, - parent_comment_id: - parentCommentId); - else if (widget.type == - CommentArtWorkType.NOVEL) - await client.postNovelComment( - widget.id, txt, - parent_comment_id: - parentCommentId); - } - _editController.clear(); - _store.fetch(); - } catch (e) { - print(e); - } - fun1(); - })), - )), - ), - ], - ), - ), - if (MediaQuery.of(context).viewInsets.bottom == 0 && - _emojiPanelShow) - _buildEmojiPanel(context), - ], - ), - ) - ], - ), - ), - ); - } - - Widget _buildTrailingRow(Comment comment, BuildContext context) { - FlyoutController controller = FlyoutController(); - return Row( - children: [ - IconButton( - onPressed: () { - if (widget.isReplay) return; - parentCommentId = comment.id; - setState(() { - parentCommentName = comment.user!.name; - }); - }, - icon: Text( - widget.isReplay ? "" : "Reply", - style: TextStyle(color: FluentTheme.of(context).accentColor), - )), - if (!widget.isReplay) - Padding( - padding: const EdgeInsets.symmetric(horizontal: 12.0), - child: FlyoutTarget( - controller: controller, - child: IconButton( - onPressed: () => controller.showFlyout( - placementMode: FlyoutPlacementMode.bottomCenter, - builder: (context) => MenuFlyout( - items: [ - MenuFlyoutItem( - text: Text(I18n.of(context).ban), - onPressed: () async { - await muteStore.insertComment(comment); - }, - ), - MenuFlyoutItem( - text: Text(I18n.of(context).report), - onPressed: () { - Reporter.show( - context, - () async => await muteStore.insertComment(comment), - ); - }, - ), - ], - ), - ), - icon: Icon(FluentIcons.more), - ), - ), - ) - ], - ); - } -} diff --git a/lib/fluent/page/create/user/create_user_page.dart b/lib/fluent/page/create/user/create_user_page.dart deleted file mode 100644 index 91156a3fd..000000000 --- a/lib/fluent/page/create/user/create_user_page.dart +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/models/create_user_response.dart'; -import 'package:pixez/network/account_client.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class CreateUserPage extends StatefulWidget { - @override - _CreateUserPageState createState() => _CreateUserPageState(); -} - -class _CreateUserPageState extends State { - late TextEditingController _userNameController; - - @override - void initState() { - _userNameController = TextEditingController(); - super.initState(); - } - - @override - void dispose() { - super.dispose(); - _userNameController.dispose(); - } - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader( - title: Text(I18n.of(context).input_nickname), - ), - content: Center( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Builder(builder: (context) { - return Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - InfoLabel( - label: '${I18n.of(context).nickname} *', - child: TextBox( - maxLines: 1, - prefix: Icon(FluentIcons.user_event), - placeholder: I18n.of(context).nickname, - controller: _userNameController, - ), - ), - FilledButton( - onPressed: () async { - try { - final name = _userNameController.text.trim(); - if (name.isEmpty) return; - final response = - await AccountClient().createProvisionalAccount(name); - print(response.data); - var createUserResponseFromJson2 = - CreateUserResponse.fromJson(response.data); - Navigator.of(context).pop(createUserResponseFromJson2); -/* AccountProvider accountProvider = new AccountProvider(); - await accountProvider.open(); - var accountResponse = createUserResponseFromJson2.body; - - var a= "Bearer l-f9qZ0ZyqSwRyZs8-MymbtWBbSxmCu1pmbOlyisou8"; - accountProvider.insert(AccountPersist() - ..accessToken = a - ..deviceToken = accountResponse.deviceToken - ..refreshToken = a - ..userImage = "" - ..userId = accountResponse.userAccount - ..name = user.name - ..isMailAuthorized = bti(user.isMailAuthorized) - ..isPremium = bti(user.isPremium) - ..mailAddress = user.mailAddress - ..account = user.account - ..xRestrict = user.xRestrict);*/ - } catch (e) { - displayInfoBar(context, - builder: (context, VoidCallback) => InfoBar( - title: Text('创建次数过多'), - )); - } - }, - child: Text("Start"), - ), - Center( - child: Text(I18n.of(context).nickname_can_be_change_anytime), - ), - HyperlinkButton( - child: Text( - I18n.of(context).terms, - ), - onPressed: () async { - final url = 'https://www.pixiv.net/terms/?page=term'; - try { - await launchUrl(Uri.parse(url)); - } catch (e) {} - }, - ), - ], - ); - }), - ), - ), - ); - } -} diff --git a/lib/fluent/page/directory/directory_page.dart b/lib/fluent/page/directory/directory_page.dart deleted file mode 100644 index ce64ba984..000000000 --- a/lib/fluent/page/directory/directory_page.dart +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:io'; - -import 'package:bot_toast/bot_toast.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:mobx/mobx.dart'; -import 'package:permission_handler/permission_handler.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/page/directory/directory_store.dart'; - -class DirectoryPage extends StatefulWidget { - final String? initPath; - - const DirectoryPage({Key? key, this.initPath}) : super(key: key); - - @override - _DirectoryPageState createState() => _DirectoryPageState(); -} - -class _DirectoryPageState extends State { - late DirectoryStore directoryStore; - - @override - void initState() { - directoryStore = DirectoryStore(); - super.initState(); - _initMethod(); - final dispose = reaction( - (_) => directoryStore.checkSuccess, - (value) { - if (value) Navigator.of(context).pop(directoryStore.path); - }, - ); - dispose(); - } - - Future _initMethod() async { - PermissionStatus statuses = await Permission.storage.request(); - if (statuses == PermissionStatus.denied) { - BotToast.showText(text: I18n.of(context).permission_denied); - Navigator.of(context).pop(); - } - directoryStore.init(widget.initPath); - } - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader( - title: Text(I18n.of(context).choose_directory), - commandBar: CommandBar( - primaryItems: [ - CommandBarButton( - icon: Icon(FluentIcons.undo), - onPressed: () { - directoryStore.undo(); - }), - CommandBarButton( - icon: Icon(FluentIcons.new_folder), - onPressed: () async { - final result = await showDialog( - context: context, - builder: (context) { - final controller = TextEditingController(); - return ContentDialog( - title: Text(I18n.of(context).create_folder), - content: TextBox( - controller: controller, - ), - actions: [ - HyperlinkButton( - child: Text(I18n.of(context).cancel), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - HyperlinkButton( - child: Text(I18n.of(context).ok), - onPressed: () { - Navigator.of(context).pop(controller.text); - }, - ), - ], - ); - }); - if (result != null) { - String folderName = result - .replaceAll("/", "") - .replaceAll("\\", "") - .replaceAll(":", "") - .replaceAll("*", "") - .replaceAll("?", "") - .replaceAll(">", "") - .replaceAll("|", "") - .replaceAll(".", "") - .replaceAll("<", ""); - if (folderName.isEmpty) { - return; - } - Directory directory = - Directory('${directoryStore.path}/$result'); - if (!directory.existsSync()) { - directory.createSync(recursive: true); - directoryStore.enterFolder(directory); - } - } - }) - ], - secondaryItems: [ - CommandBarButton( - onPressed: () async { - if (directoryStore.path == '/storage/emulated/0') return; - await directoryStore.check(); - Navigator.of(context).pop(directoryStore.path); - }, - label: Text(I18n.of(context).ok), - icon: Icon(FluentIcons.check_mark), - ) - ], - ), - ), - content: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Observer(builder: (_) { - return ListTile( - title: Text(directoryStore.path ?? ""), - ); - }), - ListTile( - leading: Icon(FluentIcons.up), - title: Text("..."), - onPressed: () { - directoryStore.backFolder(); - }, - ), - Expanded( - child: Observer(builder: (_) { - final list = directoryStore.list; - list.sort((a, b) => a.path.compareTo(b.path)); - if (list.isNotEmpty) - return Container( - child: ListView.builder( - itemCount: list.length, - itemBuilder: (context, index) { - FileSystemEntity fileSystemEntity = list[index]; - return Visibility( - visible: !(fileSystemEntity.path - .split("/") - .last - .startsWith(".")), - child: ListTile( - leading: fileSystemEntity is Directory - ? Icon(FluentIcons.folder) - : Icon(FluentIcons.file_template), - title: - Text(fileSystemEntity.path.split("/").last), - onPressed: () { - if (fileSystemEntity is Directory) { - directoryStore.enterFolder(fileSystemEntity); - } - }, - ), - ); - })); - else - return Container(); - }), - ), - ], - ), - ); - } -} diff --git a/lib/fluent/page/directory/save_mode_choice_page.dart b/lib/fluent/page/directory/save_mode_choice_page.dart deleted file mode 100644 index aa2fba477..000000000 --- a/lib/fluent/page/directory/save_mode_choice_page.dart +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -import 'package:bot_toast/bot_toast.dart'; -import 'package:device_info_plus/device_info_plus.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/constants.dart'; -import 'package:pixez/document_plugin.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:url_launcher/url_launcher.dart'; - -import 'directory_page.dart'; - -showPathDialog(BuildContext context, {bool isFirst = false}) async { - return Leader.push( - context, - SaveModeChoicePage( - isFirst: isFirst, - ), - icon: Icon(FluentIcons.settings), - title: Text(I18n.of(context).save_format), - ); -} - -class SaveModeChoicePage extends StatefulWidget { - final bool isFirst; - - SaveModeChoicePage({Key? key, required this.isFirst}) : super(key: key); - - @override - _SaveModeChoicePageState createState() => _SaveModeChoicePageState(); -} - -class _SaveModeChoicePageState extends State - with SingleTickerProviderStateMixin { - int groupValue = 0; - late AnimationController _animationController; - - @override - void initState() { - _animationController = - AnimationController(vsync: this, duration: Duration(milliseconds: 500)); - _animationController.addListener(() { - setState(() {}); - }); - super.initState(); - } - - @override - void dispose() { - _animationController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - content: Builder(builder: (context) { - return SafeArea( - child: Card( - margin: EdgeInsets.all(0.0), - child: Column( - children: [ - ListTile( - leading: Icon(FluentIcons.next, color: Colors.white), - onPressed: () async => _onPress(context), - title: Text( - I18n.of(context).start, - style: TextStyle(color: Colors.white), - )), - ComboBox( - value: groupValue, - items: [ - ComboBoxItem( - child: Text( - 'Media', - style: FluentTheme.of(context) - .typography - .body! - .copyWith(fontSize: 16.0), - ), - value: 0, - ), - ComboBoxItem( - child: Text( - 'SAF', - style: FluentTheme.of(context) - .typography - .body! - .copyWith(fontSize: 16.0), - ), - value: 1, - ), - ComboBoxItem( - child: Text( - I18n.of(context).old_way, - style: FluentTheme.of(context) - .typography - .body! - .copyWith(fontSize: 16.0), - ), - value: 2, - ), - ], - onChanged: (v) { - setState(() { - this.groupValue = v as int; - }); - if (groupValue == 0 || groupValue == 1) { - _animationController.reverse(); - } - if (groupValue == 2) { - _animationController.forward(); - } - }), - IconButton( - icon: Icon(FluentIcons.book_answers), - onPressed: () async { - await launchUrl(Uri.parse(Constants.isGooglePlay || - userSetting.disableBypassSni - ? "https://developer.android.com/training/data-storage/shared/documents-files" - : "https://developer.android.google.cn/training/data-storage/shared/documents-files")); - Navigator.of(context).pop(); - }), - IconButton( - icon: Icon(FluentIcons.chrome_close), - onPressed: () { - Navigator.of(context).pop(); - }), - if (groupValue == 0) - Expanded( - child: ListView( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - Text("MediaStore"), - Text(I18n.of(context).media_hint) - ], - ), - ) - ], - )), - if (groupValue == 1) - Expanded( - child: Stack( - children: [ - ListView( - padding: EdgeInsets.all(16.0), - children: [ - Text(I18n.of(context).saf_hint), - Padding( - padding: - const EdgeInsets.symmetric(vertical: 8.0), - child: Text(I18n.of(context).step + 1.toString()), - ), - Image.asset( - 'assets/images/step1.png', - fit: BoxFit.fitWidth, - ), - Padding( - padding: - const EdgeInsets.symmetric(vertical: 8.0), - child: Text(I18n.of(context).step + 2.toString()), - ), - Image.asset( - 'assets/images/step2.png', - fit: BoxFit.fitWidth, - ), - ], - ), - ], - ), - ), - if (groupValue == 2) - Expanded( - child: ListView( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - Text(I18n.of(context).old_way_message), - Text(I18n.of(context).legacy_mode_warning) - ], - ), - ) - ], - )) - ], - ), - ), - ); - }), - ); - } - - Future _onPress(BuildContext context) async { - if (groupValue == 0) { - await userSetting.setSaveMode(0); - Navigator.of(context).pop(); - } else if (groupValue == 1) { - await _saffun(context); - Navigator.of(context).pop(); - } else if (groupValue == 2) { - DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); - AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; - print('Running on ${androidInfo.version.sdkInt}'); - if ((androidInfo.version.sdkInt) > 29) { - BotToast.showText(text: I18n.of(context).legacy_mode_warning); - } - await _helplessfun(context, isFirst: widget.isFirst); - Navigator.of(context).pop(); - } - if (groupValue == 0 || groupValue == 1) { - _animationController.reverse(); - } - if (groupValue == 2) { - _animationController.forward(); - } - } -} - -Future _saffun(BuildContext context) async { - await userSetting.setSaveMode(1); - await DocumentPlugin.choiceFolder(); -} - -Future _helplessfun(BuildContext context, {bool isFirst = false}) async { - assert(false); - await userSetting.setSaveMode(2); - String? initPath = - isFirst ? "/storage/emulated/0/Pictures/pixez" : null; //过时api只能硬编码 - final path = await Leader.push(context, DirectoryPage(initPath: initPath)); - if (path != null) { - final _preferences = await SharedPreferences.getInstance(); - await _preferences.setString('store_path', path); - } -} diff --git a/lib/fluent/page/follow/follow_list.dart b/lib/fluent/page/follow/follow_list.dart deleted file mode 100644 index 24bb2bcaa..000000000 --- a/lib/fluent/page/follow/follow_list.dart +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:flutter/widgets.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/fluent/component/sort_group.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/lighting/lighting_store.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/network/api_client.dart'; -import 'package:pixez/fluent/page/painter/painter_list.dart'; - -class FollowList extends StatefulWidget { - final int id; - final bool isNovel; - final bool isFollowMe; - - FollowList( - {Key? key, - required this.id, - this.isNovel = false, - this.isFollowMe = false}) - : super(key: key); - - @override - _FollowListState createState() => _FollowListState(); -} - -class _FollowListState extends State { - late FutureGet futureGet; - String restrict = 'public'; - - @override - void dispose() { - super.dispose(); - } - - @override - void initState() { - futureGet = widget.isFollowMe - ? () => apiClient.getFollowUser(widget.id, restrict) - : () => apiClient.getUserFollowing(widget.id, restrict); - super.initState(); - } - - Widget buildHeader() { - return Observer(builder: (_) { - return Visibility( - visible: int.parse(accountStore.now!.userId) == widget.id, - child: Align( - alignment: Alignment.topCenter, - child: SortGroup( - children: [I18n.of(context).public, I18n.of(context).private], - onChange: (index) { - setState(() { - restrict = index == 0 ? 'public' : 'private'; - futureGet = - () => apiClient.getUserFollowing(widget.id, restrict); - }); - }, - ), - ), - ); - }); - } - - @override - Widget build(BuildContext context) { - return Stack( - children: [ - PainterList( - futureGet: futureGet, - isNovel: widget.isNovel, - header: Container( - height: widget.isFollowMe ? 0 : 45, - ), - ), - if (!widget.isFollowMe) buildHeader(), - ], - ); - } -} diff --git a/lib/fluent/page/hello/fluent_hello_page.dart b/lib/fluent/page/hello/fluent_hello_page.dart deleted file mode 100644 index 6c81523c1..000000000 --- a/lib/fluent/page/hello/fluent_hello_page.dart +++ /dev/null @@ -1,456 +0,0 @@ -import 'dart:async'; - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter/gestures.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/fluent/component/search_box.dart'; -import 'package:pixez/constants.dart'; -import 'package:pixez/custom_icon.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/fluent/page/Init/guide_page.dart'; -import 'package:pixez/fluent/page/follow/follow_list.dart'; -import 'package:pixez/fluent/page/hello/new/illust/new_illust_page.dart'; -import 'package:pixez/fluent/page/hello/ranking/rank_page.dart'; -import 'package:pixez/fluent/page/hello/recom/recom_spotlight_page.dart'; -import 'package:pixez/fluent/page/hello/setting/setting_page.dart'; -import 'package:pixez/fluent/page/login/login_page.dart'; -import 'package:pixez/fluent/page/preview/preview_page.dart'; -import 'package:pixez/fluent/page/user/bookmark/bookmark_page.dart'; -import 'package:pixez/fluent/page/user/users_page.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:window_manager/window_manager.dart'; - -class FluentHelloPage extends StatefulWidget { - @override - FluentHelloPageState createState() => FluentHelloPageState(); -} - -class FluentHelloPageState extends State with WindowListener { - late StreamSubscription _sub; - late int index; - late PageController _pageController; - static FluentHelloPageState? state; - - late PixEzNavigatorObserver _navobs; - late Navigator _nav; - final BookmarkPageMethodRelay relay = BookmarkPageMethodRelay(); - - late List<_PixEzPageItem> _pages; - late List<_PixEzPageItem> _lastpages; - - /// 空视图 - final _empty = Container(); - - /// 推送路由到视图 - /// FluentUI的跳页功能 - Future push( - BuildContext context, - PixEzPageRoute route, - ) { - assert(_navobs.navigator != null); - setState(() => index = getItemCount(_pages)); - return _navobs.navigator!.push(route); - } - - @override - void initState() { - state = this; - Constants.type = 0; - fetcher.context = context; - index = userSetting.welcomePageNum; - _pageController = PageController(initialPage: userSetting.welcomePageNum); - super.initState(); - saveStore.ctx = this.context; - saveStore.saveStream.listen((stream) { - saveStore.listenBehavior(stream); - }); - initPlatformState(); - _navobs = PixEzNavigatorObserver( - _changeIndexWhenGoBack, - _changeIndexWhenGo, - ); - _nav = Navigator( - key: GlobalKey(debugLabel: 'Navigator'), - observers: [_navobs], - onGenerateRoute: (settings) { - final widget = _getPage(index); - assert(widget != null); - return PixEzPageRoute( - builder: (context) => widget!, - index: index, - settings: settings, - ); - }, - ); - _pages = [ - _PixEzPageItem( - (context) => const Icon(FluentIcons.home), - (context) => Text(I18n.of(context).home), - Observer(builder: (context) { - if (accountStore.now != null) - return RecomSpolightPage(); - else - return PreviewPage(); - }), - ), - _PixEzPageItem( - (context) => const Icon(CustomIcons.leaderboard), - (context) => Text(I18n.of(context).rank), - Observer(builder: (context) { - if (accountStore.now != null) - return RankPage(); - else - return PreviewPage(); - }), - ), - _PixEzPageItem( - (context) => const Icon(FluentIcons.bookmarks), - (context) => Text(I18n.of(context).quick_view), - null, - items: [ - _PixEzPageItem( - (context) => const Icon(FluentIcons.news), - (context) => Text(I18n.of(context).news), - const NewIllustPage(), - ), - _PixEzPageItem( - (context) => const Icon(FluentIcons.bookmarks), - (context) => Text(I18n.of(context).bookmark), - Observer(builder: (context) { - if (accountStore.now != null) - return BookmarkPage( - relay: relay, - isNested: false, - id: int.parse(accountStore.now!.userId)); - else - return PreviewPage(); - }), - ), - _PixEzPageItem( - (context) => const Icon(FluentIcons.follow_user), - (context) => Text(I18n.of(context).followed), - Observer(builder: (context) { - if (accountStore.now != null) - return FollowList( - id: int.parse(accountStore.now!.userId), - ); - else - return PreviewPage(); - }), - ), - ], - ), - ]; - _lastpages = [ - _PixEzPageItem( - (context) => const Icon(FluentIcons.settings), - (context) => Text(I18n.of(context).setting), - const SettingPage(), - ), - _PixEzPageItem( - (context) => SizedBox( - height: 24, - width: 24, - child: Observer( - builder: (context) => CircleAvatar( - backgroundImage: PixivProvider.url( - accountStore.now?.userImage ?? - 'https://s.pximg.net/common/images/no_profile.png', - preUrl: 'https://s.pximg.net/common/images/no_profile.png', - ), - radius: 100.0, - backgroundColor: FluentTheme.of(context).accentColor, - ), - ), - ), - (context) => Text(accountStore.now?.name ?? 'Account'), - Builder( - builder: (context) => accountStore.now != null - ? UsersPage(id: int.parse(accountStore.now!.userId)) - : LoginPage(), - ), - ), - ]; - } - - @override - void dispose() { - _sub.cancel(); - _pageController.dispose(); - super.dispose(); - } - - Future initPlatformState() async { - var prefs = await SharedPreferences.getInstance(); - if (prefs.getInt('language_num') == null) { - Navigator.of(context) - .pushReplacement(FluentPageRoute(builder: (context) => GuidePage())); - } - } - - @override - Widget build(BuildContext context) { - return RawKeyboardListener( - focusNode: FocusNode(), - autofocus: true, - child: Listener( - child: NavigationView( - appBar: _buildAppBar(context), - pane: _buildPane(context), - paneBodyBuilder: (item, widget) => _nav, - ), - onPointerDown: (event) { - if (event.buttons == kBackMouseButton && - event.kind == PointerDeviceKind.mouse) { - _navobs.navigator?.maybePop(null); - } - }, - ), - onKey: (value) { - if (value is RawKeyUpEvent) { - if (value.isAltPressed && - value.logicalKey == LogicalKeyboardKey.arrowLeft) { - _navobs.navigator?.maybePop(null); - } - } - }, - ); - } - - NavigationAppBar _buildAppBar(BuildContext context) { - const height = 40.0; - - return NavigationAppBar( - height: height, - title: DragToMoveArea( - child: Align( - alignment: AlignmentDirectional.centerStart, - child: _navobs.current?.title ?? const Text('Pixez'), - ), - ), - leading: PaneItem( - icon: const Icon(FluentIcons.back, size: 14.0), - title: Text(FluentLocalizations.of(context).backButtonTooltip), - body: _empty, - enabled: _navobs.canGoBack, - ).build( - context, - false, - () => _navobs.navigator?.maybePop(context), - displayMode: PaneDisplayMode.compact, - ), - actions: SizedBox( - width: 138, - height: height, - child: WindowCaption( - brightness: FluentTheme.of(context).brightness, - backgroundColor: Colors.transparent, - ), - ), - ); - } - - NavigationPane _buildPane(BuildContext context) { - return NavigationPane( - // displayMode: PaneDisplayMode.top, - // 太丑了 不加了 - // header: Row( - // children: [ - // Image.asset( - // 'assets/images/icon.png', - // height: 48, - // width: 48, - // ), - // Container( - // margin: EdgeInsets.only(left: 8.0), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.center, - // children: [ - // Text( - // 'PixEz', - // style: FluentTheme.of(context).typography.bodyStrong, - // ), - // Text('Your Favorite Pixiv Client!') - // ], - // ), - // ), - // ], - // ), - autoSuggestBox: SearchBox(), - selected: index, - onChanged: _changedPage, - items: [ - ..._itemsBuilder(context, _pages), - if (_navobs.current != null && _navobs.current!.index == null) ...[ - PaneItemSeparator(), - PaneItem( - icon: _navobs.current?.icon ?? const Icon(FluentIcons.unknown), - title: _navobs.current?.title ?? Text(I18n.of(context).undefined), - body: _empty, - ) - ], - ], - footerItems: _itemsBuilder(context, _lastpages), - ); - } - - List _itemsBuilder( - BuildContext context, List<_PixEzPageItem> source) { - return source.map((i) { - if (i.items.isNotEmpty) { - return PaneItemExpander( - icon: i.icon(context), - items: _itemsBuilder(context, i.items), - body: _empty, - title: i.title(context), - ); - } else { - return PaneItem( - icon: i.icon(context), - body: _empty, - title: i.title(context), - ); - } - }).toList(); - } - - int getItemCount(List<_PixEzPageItem> items) => items - .map((i) => getItemCount(i.items)) - .fold(items.length, (value, element) => value + element); - - List<_PixEzPageItem> _many(List<_PixEzPageItem> items) { - List<_PixEzPageItem> result = List.empty(growable: true); - items.forEach((i) { - result.add(i); - result.addAll(_many(i.items)); - }); - return result; - } - - int _getIndex(int? index) => index ?? getItemCount(_pages); - - /// 切换页面 - void _changedPage(int index) { - if (_navobs.current?.index == null && index > getItemCount(_pages)) index--; - - assert(index < getItemCount(_pages) + getItemCount(_lastpages)); - - final widget = _getPage(index); - if (widget == null) return; - - setState(() => this.index = index); - - assert(_navobs.navigator != null); - _navobs.navigator!.push(PixEzPageRoute( - builder: (context) => widget, - index: index, - )); - } - - void _changeIndexWhenGo(PixEzPageRoute route, PixEzPageRoute? previousRoute) { - debugPrint('Go'); - this.index = _getIndex(route.index); - try { - setState(() {}); - } catch (err) { - debugPrint(err.toString()); - } - } - - /// 当导航器弹出时重设索引值 - void _changeIndexWhenGoBack( - PixEzPageRoute route, PixEzPageRoute? previousRoute) { - debugPrint('GoBack'); - try { - setState(() { - this.index = _getIndex(previousRoute?.index); - }); - } catch (err) { - debugPrint(err.toString()); - } - } - - /// 根据index获取不同页 - Widget? _getPage(int index) => index >= getItemCount(_pages) - ? _many(_lastpages)[index - getItemCount(_pages)].page - : _many(_pages)[index].page; -} - -class _PixEzPageItem { - final Widget Function(BuildContext) icon; - final Widget Function(BuildContext) title; - final Widget? page; - final List<_PixEzPageItem> items; - - _PixEzPageItem(this.icon, this.title, this.page, - {this.items = const <_PixEzPageItem>[]}); -} - -class PixEzPageRoute extends FluentPageRoute { - /// 当前活动的项目的索引 - /// 当 == null 时使用 icon 和 title 创建项目 - final int? index; - final Widget? icon; - final Widget? title; - - PixEzPageRoute({ - required super.builder, - this.icon, - this.title, - this.index, - super.maintainState, - super.barrierLabel, - super.settings, - super.fullscreenDialog = false, - }) { - if (index == null) { - if (icon == null || title == null) { - // 必须设置 index 或 icon、title。 - throw new Exception('You MUST set index or icon and title.'); - } - } else { - if (icon != null || title != null) { - // 设置 index 后不可以设置 icon、title。 - throw new Exception( - 'You MUST NOT set icon and title when you have index.'); - } - } - } -} - -/// PixEzNavigatorObserver 控制着整个应用的页面的呈现逻辑和后退历史逻辑 -class PixEzNavigatorObserver extends NavigatorObserver { - final List _histories = List.empty(growable: true); - final void Function(PixEzPageRoute, PixEzPageRoute?) onPop; - final void Function(PixEzPageRoute, PixEzPageRoute?) onPush; - - PixEzNavigatorObserver(this.onPop, this.onPush); - - /// 当前的页面 - PixEzPageRoute? get current => _histories.isEmpty ? null : _histories.last; - - /// 决定窗口左上角后退按钮是否允许用户点击 - bool get canGoBack => _histories.length > 1 && (navigator?.canPop() ?? false); - - /// 当有新的页面被推入时被激活 - @override - void didPush(Route route, Route? previousRoute) { - if (route is PixEzPageRoute) { - _histories.add(route); - onPush(route, previousRoute is PixEzPageRoute ? previousRoute : null); - } - } - - /// 当有新的页面被弹出时被激活 - @override - void didPop(Route route, Route? previousRoute) { - if (route is PixEzPageRoute) { - _histories.removeLast(); - onPop(route, previousRoute is PixEzPageRoute ? previousRoute : null); - } - } -} diff --git a/lib/fluent/page/hello/new/illust/new_illust_page.dart b/lib/fluent/page/hello/new/illust/new_illust_page.dart deleted file mode 100644 index 793821ca1..000000000 --- a/lib/fluent/page/hello/new/illust/new_illust_page.dart +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:async'; - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/fluent/component/sort_group.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/fluent/lighting/fluent_lighting_page.dart'; -import 'package:pixez/lighting/lighting_store.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/network/api_client.dart'; - -class NewIllustPage extends StatefulWidget { - final String restrict; - - const NewIllustPage({Key? key, this.restrict = "all"}) : super(key: key); - - @override - _NewIllustPageState createState() => _NewIllustPageState(); -} - -class _NewIllustPageState extends State { - late ApiForceSource futureGet; - late StreamSubscription subscription; - late ScrollController _scrollController; - - @override - void initState() { - _scrollController = ScrollController(); - futureGet = ApiForceSource( - futureGet: (e) => apiClient.getFollowIllusts(widget.restrict, force: e), - glanceKey: "follow_illust"); - super.initState(); - subscription = topStore.topStream.listen((event) { - if (event == "301") { - _scrollController.position.jumpTo(0); - } - }); - } - - @override - void dispose() { - subscription.cancel(); - _scrollController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Stack( - children: [ - LightingList( - source: futureGet, - scrollController: _scrollController, - header: Container( - height: 45.0, - ), - portal: "new", - ), - Align( - alignment: Alignment.topCenter, - child: Container( - child: SortGroup( - onChange: (index) { - if (index == 0) - setState(() { - futureGet = ApiForceSource( - futureGet: (e) => - apiClient.getFollowIllusts('all', force: e), - glanceKey: "follow_illust"); - }); - if (index == 1) - setState(() { - futureGet = ApiForceSource( - futureGet: (e) => - apiClient.getFollowIllusts('public', force: e), - glanceKey: "follow_illust"); - }); - if (index == 2) - setState(() { - futureGet = ApiForceSource( - futureGet: (e) => - apiClient.getFollowIllusts('private', force: e), - glanceKey: "follow_illust"); - }); - }, - children: [ - I18n.of(context).all, - I18n.of(context).public, - I18n.of(context).private - ], - ), - ), - ) - ], - ); - } - - Container buildContainer(BuildContext context) { - FlyoutController controller = FlyoutController(); - return Container( - child: Align( - alignment: Alignment.centerRight, - child: FlyoutTarget( - controller: controller, - child: IconButton( - icon: Icon(FluentIcons.list), - onPressed: () => controller.showFlyout( - builder: (context) => MenuFlyout( - items: [ - MenuFlyoutItem( - text: Text(I18n.of(context).all), - onPressed: () { - setState(() { - futureGet = ApiForceSource( - futureGet: (e) => apiClient.getFollowIllusts( - 'all', - force: e, - ), - glanceKey: "follow_illust", - ); - }); - }, - ), - MenuFlyoutItem( - text: Text(I18n.of(context).public), - onPressed: () { - setState(() { - futureGet = ApiForceSource( - futureGet: (e) => apiClient.getFollowIllusts( - 'public', - force: e, - ), - glanceKey: "follow_illust", - ); - }); - }, - ), - MenuFlyoutItem( - text: Text(I18n.of(context).private), - onPressed: () { - setState(() { - futureGet = ApiForceSource( - futureGet: (e) => apiClient.getFollowIllusts( - 'private', - force: e, - ), - glanceKey: "follow_illust", - ); - }); - }, - ), - ], - ), - ), - ), - ), - ), - ); - } -} diff --git a/lib/fluent/page/hello/new/new_page.dart b/lib/fluent/page/hello/new/new_page.dart deleted file mode 100644 index 6d837f1aa..000000000 --- a/lib/fluent/page/hello/new/new_page.dart +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/fluent/page/follow/follow_list.dart'; -import 'package:pixez/fluent/page/hello/new/illust/new_illust_page.dart'; -import 'package:pixez/fluent/page/preview/preview_page.dart'; -import 'package:pixez/fluent/page/user/bookmark/bookmark_page.dart'; -import 'package:pixez/fluent/page/user/users_page.dart'; - -class NewPage extends StatefulWidget { - final String newRestrict, bookRestrict, painterRestrict; - final BookmarkPageMethodRelay relay; - - const NewPage( - {Key? key, - this.newRestrict = "public", - this.bookRestrict = "public", - this.painterRestrict = "public", - required this.relay}) - : super(key: key); - - @override - _NewPageState createState() => _NewPageState(); -} - -class _NewPageState extends State - with AutomaticKeepAliveClientMixin, TickerProviderStateMixin { - int _curentPage = 0; - - @override - Widget build(BuildContext context) { - super.build(context); - return Observer(builder: (context) { - if (accountStore.now != null) - return NavigationView( - pane: NavigationPane( - displayMode: PaneDisplayMode.top, - selected: _curentPage, - onChanged: (index) { - setState(() => _curentPage = index); - }, - items: [ - PaneItem( - icon: Icon(FluentIcons.news), - title: Text(I18n.of(context).news), - body: NewIllustPage(), - ), - PaneItem( - icon: Icon(FluentIcons.bookmarks), - title: Text(I18n.of(context).bookmark), - body: BookmarkPage( - isNested: false, - id: int.parse(accountStore.now!.userId), - relay: widget.relay), - ), - PaneItem( - icon: Icon(FluentIcons.follow_user), - title: Text(I18n.of(context).followed), - body: FollowList( - id: int.parse(accountStore.now!.userId), - ), - ), - ], - footerItems: [ - if (_curentPage == 1) - PaneItemAction( - onTap: () async { - await widget.relay.sort(); - }, - icon: Icon(FluentIcons.sort), - ), - PaneItemAction( - icon: const Icon(FluentIcons.account_management), - onTap: () { - Leader.push(context, - UsersPage(id: int.parse(accountStore.now!.userId)), - icon: const Icon(FluentIcons.account_management), - title: Text(I18n.of(context).my)); - }, - ) - ], - ), - ); - - return NavigationView( - pane: NavigationPane( - displayMode: PaneDisplayMode.top, - selected: _curentPage, - onChanged: (index) { - setState(() => _curentPage = index); - }, - items: [ - PaneItem( - icon: Icon(FluentIcons.news), - title: Text( - '${I18n.of(context).follow}${I18n.of(context).news}', - ), - body: LoginInFirst(), - ), - PaneItem( - icon: Icon(FluentIcons.bookmarks), - title: Text( - '${I18n.of(context).personal}${I18n.of(context).bookmark}', - ), - body: LoginInFirst(), - ), - PaneItem( - icon: Icon(FluentIcons.follow_user), - title: Text( - '${I18n.of(context).follow}${I18n.of(context).painter}', - ), - body: LoginInFirst(), - ), - ], - ), - ); - }); - } - - @override - bool get wantKeepAlive => true; -} diff --git a/lib/fluent/page/hello/ranking/rank_page.dart b/lib/fluent/page/hello/ranking/rank_page.dart deleted file mode 100644 index 1487765c0..000000000 --- a/lib/fluent/page/hello/ranking/rank_page.dart +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:async'; - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter/material.dart' show showDatePicker; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/page/hello/ranking/rank_store.dart'; -import 'package:pixez/fluent/page/hello/ranking/ranking_mode/rank_mode_page.dart'; - -class RankPage extends StatefulWidget { - const RankPage({super.key}); - - @override - _RankPageState createState() => _RankPageState(); -} - -class _RankPageState extends State - with AutomaticKeepAliveClientMixin { - late RankStore rankStore; - final modeList = [ - "day", - "day_male", - "day_female", - "week_original", - "week_rookie", - "week", - "month", - "day_r18", - "week_r18", - "week_r18g" - ]; - var boolList = Map(); - late DateTime nowDate; - late StreamSubscription subscription; - String? dateTime; - - GlobalKey appBarKey = GlobalKey(); - ValueNotifier appBarHeightNotifier = ValueNotifier(null); - - @override - void dispose() { - subscription.cancel(); - super.dispose(); - } - - @override - void initState() { - nowDate = DateTime.now(); - rankStore = RankStore()..init(); - int i = 0; - modeList.forEach((element) { - boolList[i] = false; - i++; - }); - super.initState(); - subscription = topStore.topStream.listen((event) { - if (event == "200") { - topStore.setTop((201 + index).toString()); - } - }); - - Future.delayed( - Duration.zero, - () { - if (rankStore.inChoice || rankStore.modeList.isEmpty) { - final rankListMean = I18n.of(context).mode_list.split(' '); - _choicePage(context, rankListMean); - } - }, - ); - } - - String toRequestDate(DateTime dateTime) { - return "${dateTime.year}-${dateTime.month}-${dateTime.day}"; - } - - DateTime nowDateTime = DateTime.now(); - int index = 0; - int tapCount = 0; - - // 获取AppBar的高度,方便实现动画 - Future initAppBarHeight() async { - Size? appBarSize = - appBarKey.currentContext?.findRenderObject()?.paintBounds.size; - if (appBarSize != null) { - return appBarSize.height; - } else { - return 0; - } - } - - @override - Widget build(BuildContext context) { - super.build(context); - final rankListMean = I18n.of(context).mode_list.split(' '); - return Observer(builder: (_) { - if (rankStore.inChoice) { - return Container( - child: Center( - child: FilledButton( - child: Text(I18n.of(context).choice_you_like), - onPressed: () => _choicePage(context, rankListMean), - ), - ), - ); - } - if (rankStore.modeList.isNotEmpty) { - var list = I18n.of(context).mode_list.split(' '); - List titles = []; - for (var i = 0; i < rankStore.modeList.length; i++) { - int index = modeList.indexOf(rankStore.modeList[i]); - if (index < 0) { - debugPrint(rankStore.modeList[i] + ' is -1'); - continue; - } - titles.add(list[index]); - } - return NavigationView( - pane: NavigationPane( - header: CommandBar( - primaryItems: [ - CommandBarButton( - icon: Icon(FluentIcons.reset), - onPressed: () { - rankStore.reset(); - _choicePage(context, rankListMean); - }, - ) - ], - overflowBehavior: CommandBarOverflowBehavior.noWrap, - ), - selected: index, - onChanged: (value) => setState(() => index = value), - displayMode: PaneDisplayMode.top, - items: [ - for (int i = 0; i < titles.length; i++) - PaneItem( - icon: Icon(FluentIcons.context_menu), - title: Text(titles[i]), - body: RankModePage( - date: dateTime, - mode: rankStore.modeList[i], - index: i, - ), - ), - ], - footerItems: [ - PaneItemAction( - icon: Icon(FluentIcons.date_time), - onTap: () => _showTimePicker(context), - ) - ]), - ); - } else { - return Container( - child: Center( - child: FilledButton( - child: Text(I18n.of(context).choice_you_like), - onPressed: () => _choicePage(context, rankListMean), - ), - ), - ); - } - }); - } - - void _choicePage(BuildContext context, List rankListMean) { - showDialog( - context: context, - useRootNavigator: false, - builder: (context) => ContentDialog( - title: Text(I18n.of(context).choice_you_like), - content: StatefulBuilder( - builder: (context, setState) => SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - for (var value in rankListMean) - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0, - vertical: 2.0, - ), - child: Checkbox( - content: Text(value), - checked: _rankFilters.contains(value), - onChanged: (v) { - boolList[rankListMean.indexOf(value)] = v ?? false; - if (v ?? false) { - setState(() { - _rankFilters.add(value); - }); - } else { - setState(() { - _rankFilters.remove(value); - }); - } - }, - ), - ), - ], - ), - ), - ), - actions: [ - FilledButton( - child: Text(I18n.of(context).ok), - onPressed: () async { - await rankStore.saveChange(boolList); - rankStore.inChoice = false; - Navigator.of(context).pop(); - }, - ), - ], - ), - ); - } - - Future _showTimePicker(BuildContext context) async { - // TODO: fluent_ui的日期选择器好像有点问题 - var nowdate = DateTime.now(); - var date = await showDatePicker( - context: context, - initialDate: nowDateTime, - locale: userSetting.locale, - firstDate: DateTime(2007, 8), - //pixiv于2007年9月10日由上谷隆宏等人首次推出第一个测试版... - lastDate: nowdate); - if (date != null && mounted) { - nowDateTime = date; - setState(() { - this.dateTime = toRequestDate(date); - }); - } - - // DateTime? current = null; - // showDialog( - // context: context, - // builder: (context) => ContentDialog( - // title: Text('Choice a Date'), - // content: Container( - // child: DatePicker( - // selected: current, - // startDate: DateTime(2007, 8), - // ), - // width: 300, - // ), - // actions: [ - // Button( - // child: Text(I18n.of(context).cancel), - // onPressed: () => Navigator.of(context).pop(), - // ), - // FilledButton( - // child: Text(I18n.of(context).ok), - // onPressed: () { - // if (mounted && current != null) { - // nowDateTime = current; - // setState(() { - // this.dateTime = toRequestDate(current); - // }); - // } - // Navigator.of(context).pop(); - // }, - // ), - // ], - // ), - // ); - } - - List _rankFilters = []; - - @override - bool get wantKeepAlive => true; -} diff --git a/lib/fluent/page/hello/ranking/ranking_mode/rank_mode_page.dart b/lib/fluent/page/hello/ranking/ranking_mode/rank_mode_page.dart deleted file mode 100644 index e47aae4c0..000000000 --- a/lib/fluent/page/hello/ranking/ranking_mode/rank_mode_page.dart +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:async'; - -import 'package:flutter/widgets.dart'; -import 'package:pixez/fluent/lighting/fluent_lighting_page.dart'; -import 'package:pixez/lighting/lighting_store.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/network/api_client.dart'; - -class RankModePage extends StatefulWidget { - final String? mode; - final String? date; - final int? index; - - const RankModePage({Key? key, this.mode, this.date, this.index}) - : super(key: key); - - @override - _RankModePageState createState() => _RankModePageState(); -} - -class _RankModePageState extends State { - late ScrollController _scrollController; - late StreamSubscription subscription; - - @override - void dispose() { - _scrollController.dispose(); - subscription.cancel(); - super.dispose(); - } - - @override - void initState() { - super.initState(); - _scrollController = ScrollController(); - subscription = topStore.topStream.listen((event) { - if (event == (201 + widget.index!).toString()) { - _scrollController.position.jumpTo(0); - } - }); - } - - @override - Widget build(BuildContext context) { - return LightingList( - scrollController: _scrollController, - source: ApiForceSource( - futureGet: (e) => - apiClient.getIllustRanking(widget.mode!, widget.date, force: e), - glanceKey: "rank"), - ); - } -} diff --git a/lib/fluent/page/hello/recom/recom_manga_page.dart b/lib/fluent/page/hello/recom/recom_manga_page.dart deleted file mode 100644 index 79e0bb9be..000000000 --- a/lib/fluent/page/hello/recom/recom_manga_page.dart +++ /dev/null @@ -1,81 +0,0 @@ -import 'package:easy_refresh/easy_refresh.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/lighting/lighting_store.dart'; -import 'package:pixez/network/api_client.dart'; -import 'package:pixez/fluent/page/picture/illust_lighting_page.dart'; - -class RecomMangaPage extends StatefulWidget { - const RecomMangaPage({Key? key}) : super(key: key); - - @override - State createState() => _RecomMangaPageState(); -} - -class _RecomMangaPageState extends State { - EasyRefreshController controller = EasyRefreshController( - controlFinishLoad: true, controlFinishRefresh: true); - late LightingStore _store; - - @override - void initState() { - _store = LightingStore( - ApiSource( - futureGet: () => apiClient.getMangaRecommend(), - ), - ); - _store.fetch(); - super.initState(); - } - - @override - void dispose() { - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader( - title: Text("Manga"), - ), - content: Observer(builder: (_) { - return EasyRefresh( - controller: controller, - onLoad: () { - _store.fetchNext(); - }, - onRefresh: () { - _store.fetch(); - }, - child: Container( - child: _store.iStores.isEmpty - ? Container() - : ListView.builder( - itemBuilder: (context, index) { - final illust = _store.iStores[index].illusts; - return Card( - child: IconButton( - onPressed: () { - Leader.push( - context, - IllustLightingPage(id: illust.id), - icon: Icon(FluentIcons.picture), - title: Text(I18n.of(context).illust_id + - ': ${illust.id}'), - ); - }, - icon: PixivImage(illust!.imageUrls.medium)), - ); - }, - itemCount: _store.iStores.length, - ), - ), - ); - }), - ); - } -} diff --git a/lib/fluent/page/hello/recom/recom_spotlight_page.dart b/lib/fluent/page/hello/recom/recom_spotlight_page.dart deleted file mode 100644 index 78789a946..000000000 --- a/lib/fluent/page/hello/recom/recom_spotlight_page.dart +++ /dev/null @@ -1,428 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:async'; -import 'dart:io'; -import 'dart:math'; - -import 'package:easy_refresh/easy_refresh.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/component/pixez_default_header.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/exts.dart'; -import 'package:pixez/fluent/component/illust_card.dart'; -import 'package:pixez/fluent/component/pixez_button.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/fluent/page/hello/recom/recom_user_road.dart'; -import 'package:pixez/fluent/page/soup/soup_page.dart'; -import 'package:pixez/fluent/page/spotlight/spotlight_page.dart'; -import 'package:pixez/utils.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/lighting/lighting_store.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/spotlight_response.dart'; -import 'package:pixez/network/api_client.dart'; -import 'package:pixez/page/hello/recom/recom_user_store.dart'; -import 'package:pixez/page/hello/recom/spotlight_store.dart'; -import 'package:waterfall_flow/waterfall_flow.dart'; - -class RecomSpolightPage extends StatefulWidget { - RecomSpolightPage({Key? key}) : super(key: key); - - @override - _RecomSpolightPageState createState() => _RecomSpolightPageState(); -} - -class _RecomSpolightPageState extends State - with AutomaticKeepAliveClientMixin { - final SpotlightStore spotlightStore = SpotlightStore(null); - final LightingStore _lightingStore = LightingStore( - ApiForceSource( - futureGet: (e) => apiClient.getRecommend(), glanceKey: "recom"), - ); - final RecomUserStore _recomUserStore = RecomUserStore(null); - late StreamSubscription subscription; - final EasyRefreshController _easyRefreshController = EasyRefreshController( - controlFinishLoad: true, controlFinishRefresh: true); - final ScrollController _scrollController = ScrollController(); - - @override - void dispose() { - subscription.cancel(); - _scrollController.dispose(); - _easyRefreshController.dispose(); - super.dispose(); - } - - @override - void initState() { - _lightingStore.easyRefreshController = _easyRefreshController; - initializeScrollController(_scrollController, _lightingStore.fetchNext); - super.initState(); - subscription = topStore.topStream.listen((event) { - if (event == "100") { - _scrollController.position.jumpTo(0); - } - }); - } - - Future fetchT() async { - await spotlightStore.fetch(); - _lightingStore.fetch(); - _recomUserStore.fetch(); - } - - @override - Widget build(BuildContext context) { - super.build(context); - return buildEasyRefresh(context); - } - - bool backToTopVisible = false; - - Widget buildEasyRefresh(BuildContext context) { - return EasyRefresh.builder( - controller: _easyRefreshController, - callLoadOverOffset: Platform.isIOS ? 2 : 5, - header: PixezDefault.header(context), - onRefresh: () async { - await fetchT(); - }, - refreshOnStart: true, - onLoad: () async { - await _lightingStore.fetchNext(); - }, - childBuilder: (context, physics) => Observer( - builder: (context) => _buildWaterFall(context, physics), - ), - ); - } - - Widget _buildWaterFall(BuildContext context, ScrollPhysics physics) { - _lightingStore.iStores - .removeWhere((element) => element.illusts!.hateByUser()); - return NotificationListener( - onNotification: (ScrollNotification notification) { - ScrollMetrics metrics = notification.metrics; - if (backToTopVisible == metrics.atEdge && mounted) { - setState(() { - backToTopVisible = !backToTopVisible; - }); - } - return true; - }, - child: CustomScrollView( - controller: _scrollController, - physics: physics, - slivers: [ - SliverToBoxAdapter( - child: Container(height: 16.0), - ), - SliverToBoxAdapter( - child: _buildFirstRow(context), - ), - SliverToBoxAdapter( - child: _buidTagSpotlightRow(context), - ), - SliverToBoxAdapter( - child: _buildSecondRow(context, I18n.of(context).recommend_for_you), - ), - _buildWaterfall(context, MediaQuery.of(context).orientation) - ], - ), - ); - } - - int _buildSliderValue(BuildContext context, Orientation orientation) { - final currentValue = (orientation == Orientation.portrait - ? userSetting.crossAdapterWidth - : userSetting.hCrossAdapterWidth) - .toDouble(); - var nowAdaptWidth = max(currentValue, 50.0); - nowAdaptWidth = min(nowAdaptWidth, 2160); - return max((MediaQuery.of(context).size.width / nowAdaptWidth), 1.0) - .toInt(); - } - - Widget _buildWaterfall(BuildContext context, Orientation orientation) { - var count = 2; - if (userSetting.crossAdapt) { - count = _buildSliderValue(context, orientation); - } else { - count = (orientation == Orientation.portrait) - ? userSetting.crossCount - : userSetting.hCrossCount; - } - return _lightingStore.iStores.isNotEmpty - ? SliverWaterfallFlow( - gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount( - crossAxisCount: count, - ), - delegate: - SliverChildBuilderDelegate((BuildContext context, int index) { - return IllustCard( - lightingStore: _lightingStore, - store: _lightingStore.iStores[index], - iStores: _lightingStore.iStores, - ); - }, childCount: _lightingStore.iStores.length), - ) - : (_lightingStore.errorMessage?.isNotEmpty == true - ? SliverToBoxAdapter( - child: Container( - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - height: 50, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text(':(', - style: FluentTheme.of(context).typography.body), - ), - HyperlinkButton( - onPressed: () { - _lightingStore.fetch(force: true); - }, - child: Text(I18n.of(context).retry)), - Padding( - padding: const EdgeInsets.all(16.0), - child: Text( - (_lightingStore.errorMessage?.contains("400") == - true - ? '${I18n.of(context).error_400_hint}\n ${_lightingStore.errorMessage}' - : '${_lightingStore.errorMessage}'), - )) - ], - ), - ), - ) - : SliverToBoxAdapter( - child: Container( - height: 30, - ), - )); - } - - Widget _buidTagSpotlightRow(BuildContext context) => LayoutBuilder( - builder: (context, constraints) { - var expectCardWidget = constraints.maxWidth * 0.7; - expectCardWidget = expectCardWidget > 244 ? 244 : expectCardWidget; - final expectCardHeight = expectCardWidget * 0.525; - return Container( - height: expectCardHeight, - padding: EdgeInsets.only(left: 0.0), - child: spotlightStore.articles.isNotEmpty - ? ListView.builder( - itemBuilder: (context, index) { - final spotlight = spotlightStore.articles[index]; - return Padding( - padding: EdgeInsets.only( - top: 8.0, - bottom: 8.0, - right: 2.0, - ), - child: Hero( - tag: "spotlight_image_${spotlight.hashCode}", - child: ButtonTheme( - data: ButtonThemeData( - iconButtonStyle: ButtonStyle( - padding: ButtonState.all(EdgeInsets.zero), - backgroundColor: - ButtonState.all(Colors.transparent), - ), - ), - child: PixEzButton( - onPressed: () { - Leader.push( - context, - SoupPage( - url: spotlight.articleUrl, - spotlight: spotlight, - heroTag: - 'spotlight_image_${spotlight.hashCode}', - ), - icon: const Icon(FluentIcons.image_pixel), - title: Text( - "${I18n.of(context).spotlight}: ${spotlight.id}"), - ); - }, - child: _buildContent( - expectCardWidget, - expectCardHeight, - spotlight, - ), - ), - ), - ), - ); - }, - itemCount: spotlightStore.articles.length, - scrollDirection: Axis.horizontal, - ) - : Container(), - ); - }, - ); - - Widget _buildContent(double expectCardWidget, double expectCardHeight, - SpotlightArticle spotlight) { - return Builder( - builder: (context) { - double opacity = 0.5; - return StatefulBuilder( - builder: (context, setState) { - return MouseRegion( - onEnter: (e) { - setState(() { - opacity = 0.6; - }); - }, - onExit: (e) { - setState(() { - opacity = 0.5; - }); - }, - child: Container( - width: expectCardWidget, - height: expectCardHeight, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.cover, - image: PixivProvider.url( - spotlight.thumbnail, - ), - ), - ), - child: Container( - child: Align( - alignment: Alignment.bottomCenter, - child: Container( - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Colors.black.withOpacity(0.0), - Colors.black.withOpacity(opacity), - ], - ), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0, vertical: 8.0), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - child: Text( - "${spotlight.title}", - maxLines: 2, - style: TextStyle( - color: Colors.white, - fontSize: 14, - fontWeight: FontWeight.normal, - // shadows: [ - // Shadow( - // color: Colors.black, - // offset: Offset(0.5, 0.5), - // blurRadius: 1.0) - // ] - ), - ), - ), - ], - ), - ), - ), - ), - ), - ), - ); - }, - ); - }, - ); - } - - Widget _buildFirstRow(BuildContext context) { - return Padding( - padding: const EdgeInsets.only(top: 0.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - child: Padding( - child: Text( - I18n.of(context).spotlight, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 24.0, - color: - FluentTheme.of(context).typography.titleLarge!.color), - ), - padding: EdgeInsets.only(left: 20.0, bottom: 10.0), - ), - ), - Padding( - child: HyperlinkButton( - child: Text( - I18n.of(context).more, - style: FluentTheme.of(context).typography.body, - ), - onPressed: () { - Leader.push( - context, - SpotLightPage(), - icon: Icon(FluentIcons.light), - title: Text(I18n.of(context).spotlight), - ); - }, - ), - padding: EdgeInsets.all(8.0), - ) - ], - ), - ); - } - - Widget _buildSecondRow(BuildContext context, String title) { - return Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Padding( - child: Center( - child: Text( - title, - overflow: TextOverflow.clip, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 24.0), - ), - ), - padding: EdgeInsets.only(left: 20.0), - ), - Expanded(child: RecomUserRoad()) - ], - ); - } - - @override - bool get wantKeepAlive => true; -} diff --git a/lib/fluent/page/hello/recom/recom_user_page.dart b/lib/fluent/page/hello/recom/recom_user_page.dart deleted file mode 100644 index 98d04342d..000000000 --- a/lib/fluent/page/hello/recom/recom_user_page.dart +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -import 'package:easy_refresh/easy_refresh.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/component/pixez_default_header.dart'; -import 'package:pixez/fluent/component/painer_card.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/page/hello/recom/recom_user_store.dart'; - -class RecomUserPage extends StatefulWidget { - final RecomUserStore? recomUserStore; - - const RecomUserPage({Key? key, this.recomUserStore}) : super(key: key); - - @override - _RecomUserPageState createState() => _RecomUserPageState(); -} - -class _RecomUserPageState extends State { - late EasyRefreshController _refreshController; - late RecomUserStore _recomUserStore; - - @override - void initState() { - _refreshController = EasyRefreshController( - controlFinishLoad: true, controlFinishRefresh: true); - _recomUserStore = - widget.recomUserStore ?? RecomUserStore(_refreshController); - if (widget.recomUserStore != null) { - _recomUserStore.controller = _refreshController; - } - super.initState(); - } - - @override - void dispose() { - _recomUserStore.controller = null; - _refreshController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader( - title: Text(I18n.of(context).recommend_for_you), - ), - content: Observer( - builder: (context) { - return EasyRefresh( - controller: _refreshController, - header: PixezDefault.header(context), - onRefresh: () => _recomUserStore.fetch(), - onLoad: () => _recomUserStore.next(), - child: LayoutBuilder( - builder: (context, constraints) => GridView.builder( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: (constraints.maxWidth / 300).floor(), - childAspectRatio: 1.60, - ), - itemBuilder: (context, index) => PainterCard( - user: _recomUserStore.users[index], - ), - itemCount: _recomUserStore.users.length, - ), - ), - ); - }, - ), - ); - } -} diff --git a/lib/fluent/page/hello/recom/recom_user_road.dart b/lib/fluent/page/hello/recom/recom_user_road.dart deleted file mode 100644 index b2786eecb..000000000 --- a/lib/fluent/page/hello/recom/recom_user_road.dart +++ /dev/null @@ -1,91 +0,0 @@ -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/fluent/page/hello/recom/recom_user_page.dart'; -import 'package:pixez/page/hello/recom/recom_user_store.dart'; - -class RecomUserRoad extends StatefulWidget { - final RecomUserStore? recomUserStore; - - const RecomUserRoad({Key? key, this.recomUserStore}) : super(key: key); - - @override - _RecomUserRoadState createState() => _RecomUserRoadState(); -} - -class _RecomUserRoadState extends State { - late RecomUserStore _recomUserStore; - - @override - void initState() { - _recomUserStore = widget.recomUserStore ?? RecomUserStore(null) - ..fetch(); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Container( - height: 60, - margin: EdgeInsets.only(left: 20), - child: ButtonTheme( - data: ButtonThemeData( - iconButtonStyle: ButtonStyle( - padding: ButtonState.all(EdgeInsets.zero), - ), - ), - child: IconButton( - onPressed: () { - Leader.push( - context, - RecomUserPage(recomUserStore: _recomUserStore), - icon: Icon(FluentIcons.account_browser), - title: Text(I18n.of(context).recommend_for_you), - ); - }, - icon: Row( - children: [ - Expanded( - child: Container( - height: 40, - margin: EdgeInsets.only(left: 8.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(16.0), - topLeft: Radius.circular(16.0)), - color: Colors.transparent), - child: _recomUserStore.users.isNotEmpty - ? ListView.builder( - itemCount: _recomUserStore.users.length, - scrollDirection: Axis.horizontal, - itemBuilder: (context, index) { - return _buildUserList(index); - }, - ) - : Container(), - ), - ) - ], - ), - ), - ), - ); - } - - Padding _buildUserList(int index) { - final data = _recomUserStore.users[index]; - return Padding( - padding: const EdgeInsets.all(1.0), - child: SizedBox( - height: 40, - width: 40, - child: CircleAvatar( - backgroundImage: PixivProvider.url(data.user.profileImageUrls.medium, - preUrl: data.user.profileImageUrls.medium), - radius: 100.0, - ), - ), - ); - } -} diff --git a/lib/fluent/page/hello/setting/app_cache_page.dart b/lib/fluent/page/hello/setting/app_cache_page.dart deleted file mode 100644 index f66c9c5b3..000000000 --- a/lib/fluent/page/hello/setting/app_cache_page.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/i18n.dart'; - -class AppCachePage extends StatefulWidget { - @override - _AppCachePageState createState() => _AppCachePageState(); -} - -class _AppCachePageState extends State { - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader( - title: Text('App Cache'), - ), - content: ListView( - children: [ - ListTile( - title: Text(I18n.of(context).clear_all_cache), - ), - ], - ), - ); - } -} diff --git a/lib/fluent/page/hello/setting/copy_text_page.dart b/lib/fluent/page/hello/setting/copy_text_page.dart deleted file mode 100644 index 4f50de6a6..000000000 --- a/lib/fluent/page/hello/setting/copy_text_page.dart +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; - -class CopyTextPage extends StatefulWidget { - const CopyTextPage({Key? key}) : super(key: key); - - @override - State createState() => _CopyTextPageState(); -} - -class _CopyTextPageState extends State { - late TextEditingController _textEditingController; - final badText = ['/', '\\', ':', ' ']; - - @override - void initState() { - _textEditingController = - TextEditingController(text: userSetting.copyInfoText); - super.initState(); - } - - @override - void dispose() { - _textEditingController.dispose(); - super.dispose(); - } - - _buildActionNormalText(String text) => Button( - child: Text("$text"), - onPressed: () { - if (_textEditingController.selection.end == -1) return; - var insertText = text; - if (text == "_") insertText = "_"; - final textSelection = _textEditingController.selection; - _textEditingController.text = _textEditingController.text - .replaceRange(textSelection.start, textSelection.end, insertText); - _textEditingController.selection = textSelection.copyWith( - baseOffset: textSelection.start + insertText.length, - extentOffset: textSelection.start + insertText.length); - }, - ); - - _buildActionText(String text) => Button( - child: Text("$text"), - onPressed: () { - if (_textEditingController.selection.end == -1) return; - var insertText = "{$text}"; - if (text == "_") insertText = "_"; - final textSelection = _textEditingController.selection; - _textEditingController.text = _textEditingController.text - .replaceRange(textSelection.start, textSelection.end, insertText); - _textEditingController.selection = textSelection.copyWith( - baseOffset: textSelection.start + insertText.length, - extentOffset: textSelection.start + insertText.length); - }, - ); - - String intialFormat = - "title:{title}\npainter:{user_name}\nillust id:{illust_id}"; - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader( - title: Text(I18n.of(context).share_info_format), - commandBar: CommandBar(primaryItems: [ - CommandBarButton( - icon: Icon(FluentIcons.refresh), - onPressed: () async { - _textEditingController.text = intialFormat; - await userSetting.setCopyInfoText(intialFormat); - }), - CommandBarButton( - icon: Icon(FluentIcons.save), - onPressed: () async { - final text = _textEditingController.text; - await userSetting.setCopyInfoText(text); - Navigator.of(context).pop(); - }), - ]), - ), - content: Container( - child: ListView(children: [ - Padding( - padding: EdgeInsets.all(12), - child: InfoLabel( - label: I18n.of(context).share_info_format, - child: TextBox( - controller: _textEditingController, - maxLines: null, - ), - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Wrap( - spacing: 6.0, - children: [ - _buildActionText("title"), - _buildActionText("illust_id"), - _buildActionText("user_id"), - _buildActionText("user_name"), - _buildActionText("tags"), - _buildActionNormalText( - "https://www.pixiv.net/artworks/{illust_id}"), - _buildActionNormalText("https://www.pixiv.net/users/{user_id}"), - ], - ), - ), - ]), - ), - ); - } -} diff --git a/lib/fluent/page/hello/setting/data_export_page.dart b/lib/fluent/page/hello/setting/data_export_page.dart deleted file mode 100644 index 6c0d2bef0..000000000 --- a/lib/fluent/page/hello/setting/data_export_page.dart +++ /dev/null @@ -1,133 +0,0 @@ -import 'dart:io'; - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:path_provider/path_provider.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/models/glance_illust_persist.dart'; - -class DataExportPage extends StatefulWidget { - const DataExportPage({super.key}); - - @override - State createState() => _DataExportPageState(); -} - -class _DataExportPageState extends State { - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader( - title: Text(I18n.of(context).app_data), - ), - content: Padding( - padding: const EdgeInsets.all(8.0), - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - // ListTile( - // title: Text(I18n.of(context).export_title), - // subtitle: Text(I18n.of(context).export_tag_history), - // onPressed: () async { - // try { - // await tagHistoryStore.exportData(); - // } catch (e) { - // print(e); - // } - // }, - // ), - // ListTile( - // title: Text(I18n.of(context).import_title), - // subtitle: Text(I18n.of(context).import_tag_history), - // onPressed: () async { - // try { - // await tagHistoryStore.importData(); - // } catch (e) { - // print(e); - // BotToast.showText(text: e.toString()); - // } - // }, - // ), - // Divider(), - // ListTile( - // title: Text(I18n.of(context).export_title), - // subtitle: Text(I18n.of(context).export_bookmark_tag), - // onPressed: () async { - // try { - // await bookTagStore.exportData(); - // } catch (e) { - // print(e); - // } - // }, - // ), - // ListTile( - // title: Text(I18n.of(context).import_title), - // subtitle: Text(I18n.of(context).import_bookmark_tag), - // onPressed: () async { - // try { - // await bookTagStore.importData(); - // } catch (e) { - // print(e); - // BotToast.showText(text: e.toString()); - // } - // }, - // ), - // Divider(), - ListTile( - title: Text(I18n.of(context).clear_all_cache), - onPressed: () async { - try { - await _showClearCacheDialog(context); - } catch (e) {} - }, - ), - ], - ), - ), - ), - ); - } - - Future _showClearCacheDialog(BuildContext context) async { - final result = await showDialog( - builder: (BuildContext context) { - return ContentDialog( - title: Text(I18n.of(context).clear_all_cache), - actions: [ - Button( - child: Text(I18n.of(context).cancel), - onPressed: () { - Navigator.of(context).pop("CANCEL"); - }, - ), - Button( - child: Text(I18n.of(context).ok), - onPressed: () { - Navigator.of(context).pop("OK"); - }, - ), - ], - ); - }, - context: context); - switch (result) { - case "OK": - { - try { - Directory tempDir = await getTemporaryDirectory(); - tempDir.deleteSync(recursive: true); - cleanGlanceData(); - } catch (e) {} - } - break; - } - } - - void cleanGlanceData() async { - GlanceIllustPersistProvider glanceIllustPersistProvider = - GlanceIllustPersistProvider(); - await glanceIllustPersistProvider.open(); - await glanceIllustPersistProvider.deleteAll(); - await glanceIllustPersistProvider.close(); - } -} diff --git a/lib/fluent/page/hello/setting/save_eval_page.dart b/lib/fluent/page/hello/setting/save_eval_page.dart deleted file mode 100644 index 70d48e1d8..000000000 --- a/lib/fluent/page/hello/setting/save_eval_page.dart +++ /dev/null @@ -1,163 +0,0 @@ -import 'dart:convert'; - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter/services.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/illust.dart'; - -class SaveEvalPage extends StatefulWidget { - final String? eval; - const SaveEvalPage({Key? key, this.eval}) : super(key: key); - - @override - State createState() => _SaveEvalPageState(); -} - -class _SaveEvalPageState extends State { - late TextEditingController _textEditingController; - String? _fileName; - Illusts _illusts = Illusts( - id: 100000, - title: "title", - type: "illust", - imageUrls: ImageUrls( - squareMedium: - "https://i.pximg.net/c/540x540_70/img-master/img/2020/12/31/00/00/00/84800000_p0_master1200.jpg", - medium: - "https://i.pximg.net/c/540x540_70/img-master/img/2020/12/31/00/00/00/84800000_p0_master1200.jpg", - large: - "https://i.pximg.net/c/540x540_70/img-master/img/2020/12/31/00/00/00/84800000_p0_master1200.jpg", - ), - caption: "caption", - restrict: 0, - user: User( - id: 100000, - name: "name", - account: "account", - profileImageUrls: ProfileImageUrls( - medium: - "https://i.pximg.net/c/540x540_70/img-master/img/2020/12/31/00/00/00/84800000_p0_master1200.jpg", - ), - isFollowed: false, - ), - tags: [ - Tags(name: "tag1", translatedName: "tag1Tranlate"), - Tags(name: "tag2", translatedName: "tag2Tranlate"), - ], - tools: ["SAI"], - createDate: "2020-12-31T00:00:00+09:00", - pageCount: 1, - width: 500, - height: 500, - sanityLevel: 6, - xRestrict: 0, - metaPages: [], - totalView: 100000, - totalBookmarks: 1000, - isBookmarked: false, - visible: true, - isMuted: false, - illustAIType: 1); - - @override - void initState() { - _textEditingController = - TextEditingController(text: widget.eval ?? userSetting.nameEval); - super.initState(); - } - - @override - void dispose() { - _textEditingController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return ContentDialog( - title: PageHeader( - title: Text("Eval"), - commandBar: CommandBar( - mainAxisAlignment: MainAxisAlignment.end, - primaryItems: [ - CommandBarButton( - onPressed: () async { - final text = _textEditingController.text.trim(); - if (text.isEmpty) return; - final string = - await saveStore.testEvalName(text, _illusts, 1, "png"); - await userSetting.setNameEval(string); - await userSetting.setFileNameEval(1); - }, - icon: Icon(FluentIcons.check_mark)) - ], - ), - ), - content: Container( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - ListTile( - title: Text("File Name:"), - subtitle: Text(_fileName ?? "undefined"), - ), - Padding( - padding: const EdgeInsets.all(16.0), - child: InfoLabel( - label: 'Code', - child: TextBox( - expands: true, - maxLines: null, - keyboardType: TextInputType.multiline, - controller: _textEditingController, - placeholder: 'Input Code here', - ), - ), - ), - HyperlinkButton( - onPressed: () { - Clipboard.getData("text/plain").then((value) { - if (value == null || value.text == null) return; - if (!value.text!.startsWith("pixez")) return; - final link = Uri.tryParse(value.text!); - if (link == null) return; - final base64 = link.queryParameters["code"]; - if (base64 == null) return; - final result = String.fromCharCodes(base64Decode(base64)); - run(result); - }); - }, - child: Text("Read link from scheme"), - ), - ], - ), - ), - actions: [ - Button( - child: Text(I18n.of(context).cancel), - onPressed: Navigator.of(context).pop, - ), - FilledButton( - onPressed: () async { - final text = _textEditingController.text.trim(); - if (text.isEmpty) return; - run(text); - }, - child: Text("Run"), - ), - ], - ); - } - - void run(String text) async { - try { - final string = await saveStore.testEvalName(text, _illusts, 1, "png"); - setState(() { - _fileName = string; - }); - } catch (e) { - print(e); - } - } -} diff --git a/lib/fluent/page/hello/setting/save_format_page.dart b/lib/fluent/page/hello/setting/save_format_page.dart deleted file mode 100644 index d8611a022..000000000 --- a/lib/fluent/page/hello/setting/save_format_page.dart +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:bot_toast/bot_toast.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; - -class SaveFormatPage extends StatefulWidget { - @override - _SaveFormatPageState createState() => _SaveFormatPageState(); -} - -class _SaveFormatPageState extends State { - late TextEditingController _textEditingController; - final badText = ['/', '\\', ':', ' ']; - - @override - void initState() { - _textEditingController = TextEditingController(text: userSetting.format); - super.initState(); - _textEditingController.addListener(() { - bool needBack = false; - String beforeText = _textEditingController.text; - badText.forEach((element) { - if (_textEditingController.text.contains(element)) { - needBack = true; - beforeText = beforeText.replaceAll(element, ""); - } - }); - if (needBack) { - BotToast.showText(text: "illegal text"); - _textEditingController.text = beforeText; - } - }); - } - - @override - void dispose() { - _textEditingController.dispose(); - super.dispose(); - } - - _buildActionText(String text) => Button( - child: Text("$text"), - onPressed: () { - if (_textEditingController.selection.end == -1) return; - var insertText = "{$text}"; - if (text == "_") insertText = "_"; - final textSelection = _textEditingController.selection; - _textEditingController.text = _textEditingController.text - .replaceRange(textSelection.start, textSelection.end, insertText); - _textEditingController.selection = textSelection.copyWith( - baseOffset: textSelection.start + insertText.length, - extentOffset: textSelection.start + insertText.length); - }, - ); - String intialFormat = "{illust_id}_p{part}"; - - @override - Widget build(BuildContext context) { - return ContentDialog( - title: PageHeader( - title: Text(I18n.of(context).save_format), - commandBar: CommandBar( - mainAxisAlignment: MainAxisAlignment.end, - primaryItems: [ - CommandBarButton( - icon: Icon(FluentIcons.refresh), - onPressed: () async { - _textEditingController.text = intialFormat; - await userSetting.setFormat(intialFormat); - }, - ), - CommandBarButton( - icon: Icon(FluentIcons.save), - onPressed: () { - var needBack = false; - badText.forEach((element) { - if (_textEditingController.text.contains(element)) { - needBack = true; - } - }); - if (!_textEditingController.text.contains('{part}')) { - BotToast.showText( - text: I18n.of(context) - .save_format_lose_part_warning('{part}')); - return; - } - if (_textEditingController.text.isNotEmpty && !needBack) - Navigator.of(context).pop(_textEditingController.text); - }, - ), - ], - ), - ), - content: Container( - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: InfoLabel( - label: 'File Name Format', - child: TextBox( - controller: _textEditingController, - placeholder: 'Input File Name Format', - ), - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Wrap( - spacing: 4.0, - children: [ - _buildActionText("title"), - _buildActionText("_"), - _buildActionText("part"), - _buildActionText("illust_id"), - _buildActionText("user_id"), - _buildActionText("user_name"), - ], - ), - ), - Observer(builder: (_) { - return ToggleSwitch( - content: Text(I18n.of(context).clear_old_format_file + - '\n' + - I18n.of(context).clear_old_format_file_message), - onChanged: (bool value) { - userSetting.setIsClearnOldFormatFile(value); - }, - checked: userSetting.isClearOldFormatFile, - ); - }), - Table( - children: [ - TableRow(children: [ - Text("Name"), - Text("Result"), - ]), - TableRow(children: [ - Text('{illust_id}'), - Text(I18n.of(context).illust_id), - ]), - TableRow(children: [ - Text('{title}'), - Text(I18n.of(context).title), - ]), - TableRow(children: [ - Text('{user_id}'), - Text(I18n.of(context).painter_id), - ]), - TableRow(children: [ - Text('{user_name}'), - Text(I18n.of(context).painter_name), - ]), - TableRow(children: [ - Text('part'), - Text(I18n.of(context).which_part), - ]), - ], - ) - ], - ), - ), - ), - actions: [ - FilledButton( - child: Text(I18n.of(context).ok), - onPressed: Navigator.of(context).pop, - ), - ], - ); - } -} diff --git a/lib/fluent/page/hello/setting/setting_cross_adapter_page.dart b/lib/fluent/page/hello/setting/setting_cross_adapter_page.dart deleted file mode 100644 index 282a91afb..000000000 --- a/lib/fluent/page/hello/setting/setting_cross_adapter_page.dart +++ /dev/null @@ -1,116 +0,0 @@ -import 'dart:math'; - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/main.dart'; -import 'package:waterfall_flow/waterfall_flow.dart'; - -class SettingCrossAdpaterPage extends StatefulWidget { - final bool h; - const SettingCrossAdpaterPage({Key? key, required this.h}) : super(key: key); - - @override - State createState() => - _SettingCrossAdpaterPageState(); -} - -class _SettingCrossAdpaterPageState extends State { - var _sliderValue = 100.0; - @override - void initState() { - super.initState(); - _initMethod(); - } - - _initMethod() { - final currentValue = _buildSliderValue(); - setState(() { - _sliderValue = currentValue; - }); - } - - @override - void dispose() { - _disposeMethod(); - super.dispose(); - } - - _disposeMethod() { - final value = _sliderValue; - if (widget.h) { - userSetting.persisitHCrossAdapterWidth(value.toInt()); - userSetting.setHCrossAdapterWidth(value.toInt()); - } else { - userSetting.persisitCrossAdapterWidth(value.toInt()); - userSetting.setCrossAdapterWidth(value.toInt()); - } - } - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader( - title: const Text('Cross Adapter'), - ), - content: LayoutBuilder(builder: (_, constraints) { - final screenWidth = constraints.maxWidth; - return Container( - child: CustomScrollView( - slivers: [ - SliverToBoxAdapter( - child: Slider( - value: _sliderValue, - min: 50, - max: 2160, - onChanged: (value) { - setState(() { - _sliderValue = value; - }); - }, - onChangeEnd: (value) async {}, - ), - ), - SliverToBoxAdapter( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: Text( - "current:${_sliderValue} screen width:$screenWidth count:${screenWidth ~/ _sliderValue}"), - ), - ), - SliverWaterfallFlow( - gridDelegate: _buildGridDelegate(_sliderValue), - delegate: SliverChildBuilderDelegate((context, index) { - return AspectRatio( - aspectRatio: 1.0, - child: Container( - color: Colors.grey, - margin: EdgeInsets.all(16), - child: Center( - child: Text(index.toString()), - )), - ); - }, childCount: 100), - ) - ], - ), - ); - }), - ); - } - - double _buildSliderValue() { - final currentValue = (!widget.h - ? userSetting.crossAdapterWidth - : userSetting.hCrossAdapterWidth) - .toDouble(); - var nowAdaptWidth = max(currentValue, 50.0); - nowAdaptWidth = min(nowAdaptWidth, 4096); - return nowAdaptWidth; - } - - _buildGridDelegate(double value) { - final count = max((MediaQuery.of(context).size.width / value), 1.0).toInt(); - return SliverWaterfallFlowDelegateWithFixedCrossAxisCount( - crossAxisCount: count, - ); - } -} diff --git a/lib/fluent/page/hello/setting/setting_page.dart b/lib/fluent/page/hello/setting/setting_page.dart deleted file mode 100644 index 7c986f8b4..000000000 --- a/lib/fluent/page/hello/setting/setting_page.dart +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/fluent/component/new_version_chip.dart'; -import 'package:pixez/fluent/component/painter_avatar.dart'; -import 'package:pixez/constants.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/er/lprinter.dart'; -import 'package:pixez/er/updater.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/fluent/page/about/about_page.dart'; -import 'package:pixez/fluent/page/account/edit/account_edit_page.dart'; -import 'package:pixez/fluent/page/account/select/account_select_page.dart'; -import 'package:pixez/fluent/page/book/tag/book_tag_page.dart'; -import 'package:pixez/fluent/page/hello/recom/recom_manga_page.dart'; -import 'package:pixez/fluent/page/hello/setting/data_export_page.dart'; -import 'package:pixez/fluent/page/hello/setting/setting_quality_page.dart'; -import 'package:pixez/fluent/page/history/history_page.dart'; -import 'package:pixez/fluent/page/login/login_page.dart'; -import 'package:pixez/fluent/page/network/network_setting_page.dart'; -import 'package:pixez/fluent/page/shield/shield_page.dart'; -import 'package:pixez/fluent/page/task/job_page.dart'; -import 'package:pixez/fluent/page/theme/theme_page.dart'; -import 'package:pixez/page/novel/history/novel_history_page.dart'; -import 'package:pixez/page/novel/novel_rail.dart'; - -class SettingPage extends StatefulWidget { - const SettingPage({Key? key}) : super(key: key); - - @override - _SettingPageState createState() => _SettingPageState(); -} - -class _SettingPageState extends State { - @override - void initState() { - super.initState(); - initMethod(); - } - - bool hasNewVersion = false; - - initMethod() async { - if (Updater.result != Result.timeout) { - bool hasNew = Updater.result == Result.yes; - if (mounted) - setState(() { - hasNewVersion = hasNew; - }); - return; - } - Result result = await Updater.check(); - switch (result) { - case Result.yes: - if (mounted) { - setState(() { - hasNewVersion = true; - }); - } - break; - default: - if (mounted) { - setState(() { - hasNewVersion = false; - }); - } - } - } - - @override - Widget build(BuildContext context) { - return ScaffoldPage.scrollable( - header: PageHeader( - title: Text(I18n.of(context).setting), - commandBar: CommandBar( - mainAxisAlignment: MainAxisAlignment.end, - primaryItems: [ - if (kDebugMode) - CommandBarButton( - icon: Icon(FluentIcons.code), - onPressed: () { - _showSavedLogDialog(context); - }), - CommandBarButton( - icon: Icon( - FluentIcons.color, - color: FluentTheme.of(context).typography.body?.color, - ), - onPressed: () => showDialog( - context: context, - builder: (context) => ThemePage(), - useRootNavigator: false, - ), - ), - ], - ), - ), - children: [ - Observer(builder: (context) { - if (accountStore.now == null) return Container(); - return SingleChildScrollView( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: ListTile( - leading: PainterAvatar( - url: accountStore.now!.userImage, - id: int.parse(accountStore.now!.userId), - ), - title: Text(accountStore.now!.name, - style: FluentTheme.of(context).typography.title), - subtitle: Text( - accountStore.now!.mailAddress, - style: FluentTheme.of(context).typography.caption, - ), - onPressed: () { - showDialog( - context: context, - builder: (context) => AccountSelectPage(), - useRootNavigator: false, - ); - }, - ), - ), - ListTile( - leading: Icon(FluentIcons.account_management), - title: Text(I18n.of(context).account_message), - onPressed: () { - showDialog( - context: context, - builder: (context) => AccountEditPage(), - useRootNavigator: false, - ); - }, - ) - ], - ), - ); - }), - Divider(), - Column( - children: [ - ListTile( - leading: Icon(FluentIcons.history), - title: Text(I18n.of(context).history_record), - trailing: Icon(FluentIcons.chevron_right), - onPressed: () { - Leader.push( - context, - Constants.type == 0 ? HistoryPage() : NovelHistory(), - icon: Icon(FluentIcons.history), - title: Text(I18n.of(context).history_record), - ); - }, - ), - ListTile( - leading: Icon(FluentIcons.settings), - title: Text(I18n.of(context).quality_setting), - trailing: Icon(FluentIcons.chevron_right), - onPressed: () { - Leader.push( - context, - SettingQualityPage(), - icon: Icon(FluentIcons.settings), - title: Text(I18n.of(context).quality_setting), - ); - }, - ), - ListTile( - leading: Icon(FluentIcons.bookmarks), - title: Text(I18n.of(context).favorited_tag), - trailing: Icon(FluentIcons.chevron_right), - onPressed: () => Leader.pushWithScaffold( - context, - BookTagPage(), - icon: Icon(FluentIcons.bookmarks), - title: Text(I18n.of(context).favorited_tag), - ), - ), - ListTile( - leading: Icon(FluentIcons.blocked), - title: Text(I18n.of(context).shielding_settings), - onPressed: () => showDialog( - context: context, - builder: (context) => ShieldPage(), - useRootNavigator: false, - ), - ), - ListTile( - leading: Icon(FluentIcons.save), - title: Text(I18n.of(context).task_progress), - onPressed: () => showDialog( - context: context, - builder: (context) => JobPage(), - useRootNavigator: false, - ), - ), - ListTile( - leading: Icon(FluentIcons.database), - title: Text(I18n.of(context).app_data), - trailing: Icon(FluentIcons.chevron_right), - onPressed: () => Leader.push( - context, - DataExportPage(), - icon: Icon(FluentIcons.database), - title: Text(I18n.of(context).app_data), - ), - ), - ], - ), - Divider(), - Column( - children: [ - ListTile( - leading: Icon(FluentIcons.library), - title: Text('Manga'), - trailing: Icon(FluentIcons.chevron_right), - onPressed: () => Leader.push( - context, - RecomMangaPage(), - title: Text('Manga'), - icon: Icon(FluentIcons.library), - ), - ), - ListTile( - leading: Icon(FluentIcons.plain_text), - title: Text('Novel'), - trailing: Icon(FluentIcons.chevron_right), - onPressed: () => Leader.push( - context, - NovelRail(), - title: Text('Novel'), - icon: Icon(FluentIcons.plain_text), - ), - ), - if (kDebugMode) - ListTile( - title: Text("网络诊断"), - onPressed: () { - showDialog( - context: context, - builder: (context) => NetworkSettingPage(), - useRootNavigator: false, - ); - }, - ), - ListTile( - leading: Icon(FluentIcons.message), - title: Text(I18n.of(context).about), - onPressed: () => Leader.push( - context, - AboutPage(newVersion: hasNewVersion), - icon: Icon(FluentIcons.message), - title: Text(I18n.of(context).about), - ), - trailing: Row( - children: [ - Visibility( - child: NewVersionChip(), - visible: hasNewVersion, - ), - Icon(FluentIcons.chevron_right), - ], - ), - ), - Observer(builder: (context) { - if (accountStore.now != null) - return ListTile( - leading: Icon(FluentIcons.sign_out), - title: Text(I18n.of(context).logout), - onPressed: () => _showLogoutDialog(context), - ); - else - return ListTile( - leading: Icon(FluentIcons.signin), - title: Text(I18n.of(context).login), - trailing: Icon(FluentIcons.chevron_right), - onPressed: () => Leader.push( - context, - LoginPage(), - icon: Icon(FluentIcons.signin), - title: Text(I18n.of(context).login), - ), - ); - }) - ], - ) - ], - ); - } - - Future _showSavedLogDialog(BuildContext context) async { - var savedLogFile = await LPrinter.savedLogFile(); - var content = savedLogFile.readAsStringSync(); - final result = await showDialog( - context: context, - builder: (context) { - return ContentDialog( - title: Text("Log"), - content: Container( - child: Text(content), - height: 400, - ), - actions: [ - Button( - child: Text(I18n.of(context).cancel), - onPressed: () { - Navigator.of(context).pop("CANCEL"); - }, - ), - FilledButton( - child: Text(I18n.of(context).ok), - onPressed: () { - Navigator.of(context).pop("OK"); - }, - ), - ], - ); - }); - switch (result) { - case "OK": - {} - break; - case "CANCEL": - {} - break; - } - } - - Future _showLogoutDialog(BuildContext context) async { - final result = await showDialog( - context: context, - builder: (context) { - return ContentDialog( - title: Text(I18n.of(context).logout), - actions: [ - Button( - child: Text(I18n.of(context).cancel), - onPressed: () { - Navigator.of(context).pop("CANCEL"); - }, - ), - FilledButton( - child: Text(I18n.of(context).ok), - onPressed: () { - Navigator.of(context).pop("OK"); - }, - ), - ], - ); - }); - switch (result) { - case "OK": - { - accountStore.deleteAll(); - } - break; - case "CANCEL": - {} - break; - } - } -} diff --git a/lib/fluent/page/hello/setting/setting_prefs_page.dart b/lib/fluent/page/hello/setting/setting_prefs_page.dart deleted file mode 100644 index 762d9c2d2..000000000 --- a/lib/fluent/page/hello/setting/setting_prefs_page.dart +++ /dev/null @@ -1,265 +0,0 @@ -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; - -class SettingPrefsPage extends StatefulWidget { - const SettingPrefsPage({Key? key}) : super(key: key); - - @override - State createState() => _SettingPrefsPageState(); -} - -class _SettingPrefsPageState extends State { - @override - Widget build(BuildContext context) { - return Observer(builder: (_) { - return ScaffoldPage( - header: PageHeader(title: Text(I18n.of(context).setting)), - content: CustomScrollView(slivers: [ - SliverToBoxAdapter( - child: Container( - height: 30, - ), - ), - SliverToBoxAdapter( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: Card( - child: Column(children: [ - _buildRow(I18n.of(context).select_language, - subtitle: userSetting.languageList[userSetting.languageNum], - onTap: () { - Leader.push( - context, - SettingLanguagePage(), - icon: Icon(FluentIcons.locale_language), - title: Text(I18n.of(context).select_language), - ); - }), - ]), - ), - )), - SliverToBoxAdapter( - child: Container( - height: 10, - ), - ), - SliverToBoxAdapter( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: Card( - child: Column(children: [ - _buildRow(I18n.of(context).illustration_detail_page_quality, - subtitle: userSetting.languageList[userSetting.languageNum], - onTap: () { - Leader.push( - context, - SettingLanguagePage(), - icon: Icon(FluentIcons.locale_language), - title: Text(I18n.of(context).select_language), - ); - }), - _buildRow(I18n.of(context).manga_detail_page_quality, - subtitle: userSetting.languageList[userSetting.languageNum], - onTap: () { - Leader.push( - context, - SettingLanguagePage(), - icon: Icon(FluentIcons.locale_language), - title: Text(I18n.of(context).select_language), - ); - }), - _buildRow(I18n.of(context).large_preview_zoom_quality, - subtitle: userSetting.languageList[userSetting.languageNum], - onTap: () { - Leader.push( - context, - SettingLanguagePage(), - icon: Icon(FluentIcons.locale_language), - title: Text(I18n.of(context).select_language), - ); - }), - ]), - ), - )) - ]), - ); - }); - } - - Widget _buildRow(String title, - {String? subtitle, GestureTapCallback? onTap}) { - return IconButton( - onPressed: () { - onTap?.call(); - }, - icon: Padding( - padding: const EdgeInsets.all(14.5), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(title), - Container( - child: Row(children: [ - Text( - subtitle ?? "", - style: TextStyle( - color: FluentTheme.of(context).typography.caption!.color), - ), - Icon( - FluentIcons.go, - color: FluentTheme.of(context).typography.caption!.color, - ) - ])) - ], - ), - ), - ); - } -} - -class SettingLanguagePage extends StatefulWidget { - const SettingLanguagePage({Key? key}) : super(key: key); - - @override - State createState() => _SettingLanguagePageState(); -} - -class _SettingLanguagePageState extends State { - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader(title: Text(I18n.of(context).select_language)), - content: CustomScrollView(slivers: [ - SliverToBoxAdapter( - child: Container( - height: 30, - ), - ), - SliverToBoxAdapter( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: Card( - child: Column(children: [ - for (var i in userSetting.languageList) - SettingSelectRow( - title: i, - select: userSetting.languageNum == - userSetting.languageList.indexOf(i), - onTap: () { - int index = userSetting.languageList.indexOf(i); - if (index == -1) return; - userSetting.setLanguageNum(index); - Navigator.of(context).pop(); - }), - ]), - ), - )) - ]), - ); - } -} - -class SettingSelectPage extends StatefulWidget { - final String title; - const SettingSelectPage({Key? key, required this.title}) : super(key: key); - - @override - State createState() => _SettingSelectPageState(); -} - -class _SettingSelectPageState extends State { - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader( - title: Text(widget.title), - ), - ); - } -} - -class SettingSelectRow extends StatefulWidget { - final String title; - final bool select; - final GestureTapCallback? onTap; - const SettingSelectRow( - {Key? key, required this.title, required this.select, this.onTap}) - : super(key: key); - - @override - State createState() => _SettingSelectRowState(); -} - -class _SettingSelectRowState extends State { - @override - Widget build(BuildContext context) { - return IconButton( - onPressed: () { - widget.onTap?.call(); - }, - icon: Padding( - padding: const EdgeInsets.all(14.5), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(widget.title), - Container( - child: Row(children: [ - if (widget.select) - Icon( - FluentIcons.check_mark, - color: FluentTheme.of(context).typography.caption!.color, - ) - ])) - ], - ), - ), - ); - } -} - -class SettingRow extends StatefulWidget { - final String title; - final String? subTitle; - final GestureTapCallback? onTap; - const SettingRow({Key? key, required this.title, this.subTitle, this.onTap}) - : super(key: key); - - @override - State createState() => _SettingRowState(); -} - -class _SettingRowState extends State { - @override - Widget build(BuildContext context) { - return IconButton( - onPressed: () { - widget.onTap?.call(); - }, - icon: Padding( - padding: const EdgeInsets.all(14.5), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(widget.title), - Container( - child: Row(children: [ - Text( - widget.subTitle ?? "", - style: TextStyle( - color: FluentTheme.of(context).typography.caption!.color), - ), - Icon( - FluentIcons.go, - color: FluentTheme.of(context).typography.caption!.color, - ) - ])) - ], - ), - ), - ); - } -} diff --git a/lib/fluent/page/hello/setting/setting_quality_page.dart b/lib/fluent/page/hello/setting/setting_quality_page.dart deleted file mode 100644 index d0ebc9709..000000000 --- a/lib/fluent/page/hello/setting/setting_quality_page.dart +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:io'; - -import 'package:bot_toast/bot_toast.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/fluent/component/pixez_button.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/page/about/languages.dart'; -import 'package:pixez/fluent/page/hello/setting/copy_text_page.dart'; -import 'package:pixez/fluent/page/hello/setting/setting_cross_adapter_page.dart'; -import 'package:pixez/fluent/page/network/network_page.dart'; -import 'package:pixez/fluent/page/platform/platform_page.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class SettingQualityPage extends StatefulWidget { - @override - _SettingQualityPageState createState() => _SettingQualityPageState(); -} - -class _SettingQualityPageState extends State - with TickerProviderStateMixin { - late Widget _languageTranlator; - - final _typeList = ["rank", "follow_illust", "recom"]; - SharedPreferences? _pref; - int _widgetTypeIndex = -1; - - @override - void initState() { - _buildLanguageTranlators(); - _initData(); - super.initState(); - } - - _initData() async { - _pref = await SharedPreferences.getInstance(); - final type = await _pref?.getString("widget_illust_type") ?? "recom"; - int index = _typeList.indexOf(type); - if (index == -1) { - setState(() { - _widgetTypeIndex = index; - }); - } - } - - @override - Widget build(BuildContext context) { - return ScaffoldPage.scrollable( - header: PageHeader( - title: Text(I18n.of(context).quality_setting), - ), - children: [ - if (Platform.isWindows) - ListTile( - title: Text(I18n.of(context).platform_special_setting), - subtitle: Text( - "For Windows", - style: TextStyle(color: Colors.blue), - ), - onPressed: () { - showDialog( - context: context, - builder: (context) => PlatformPage(), - useRootNavigator: false, - ); - }, - ), - ListTile( - title: Text(I18n.of(context).network), - trailing: Icon(FluentIcons.chevron_right), - onPressed: () { - Leader.push( - context, - NetworkPage( - automaticallyImplyLeading: true, - ), - icon: Icon(FluentIcons.chevron_right), - title: Text(I18n.of(context).network), - ); - }, - ), - ListTile( - title: Text(I18n.of(context).large_preview_zoom_quality), - trailing: Observer(builder: (_) { - return ComboBox( - value: userSetting.zoomQuality, - items: [ - ComboBoxItem( - child: Text(I18n.of(context).large), - value: 0, - ), - ComboBoxItem( - child: Text(I18n.of(context).source), - value: 1, - ), - ], - onChanged: (selected) { - userSetting.change(selected!); - }, - ); - }), - ), - ListTile( - title: Text(I18n.of(context).illustration_detail_page_quality), - trailing: Observer(builder: (_) { - return ComboBox( - value: userSetting.pictureQuality, - items: [ - ComboBoxItem( - child: Text(I18n.of(context).medium), - value: 0, - ), - ComboBoxItem( - child: Text(I18n.of(context).large), - value: 1, - ), - ], - onChanged: (selected) { - userSetting.setPictureQuality(selected!); - }, - ); - }), - ), - ListTile( - title: Text(I18n.of(context).manga_detail_page_quality), - trailing: Observer(builder: (_) { - return ComboBox( - value: userSetting.mangaQuality, - items: [ - ComboBoxItem( - child: Text(I18n.of(context).medium), - value: 0, - ), - ComboBoxItem( - child: Text(I18n.of(context).large), - value: 1, - ), - ComboBoxItem( - child: Text(I18n.of(context).source), - value: 2, - ), - ], - onChanged: (selected) { - userSetting.setMangaQuality(selected!); - }, - ); - }), - ), - ListTile( - title: Text("Language"), - trailing: Row( - children: [ - _languageTranlator, - Padding( - padding: EdgeInsets.only(left: 8, right: 8), - child: Icon(FluentIcons.translate), - ), - Observer(builder: (_) { - return ComboBox( - value: userSetting.languageNum, - items: Languages.map((e) => e.language) - .toList() - .asMap() - .entries - .map((i) => ComboBoxItem( - child: Text(i.value), - value: i.key, - )) - .toList(), - onChanged: (index) async { - await userSetting.setLanguageNum(index!); - setState(() { - _buildLanguageTranlators(); - }); - }, - ); - }) - ], - ), - ), - ListTile( - title: Text(I18n.of(context).welcome_page), - trailing: Observer(builder: (_) { - final tablist = [ - I18n.of(context).home, - I18n.of(context).rank, - I18n.of(context).quick_view, - I18n.of(context).setting, - ]; - return ComboBox( - value: userSetting.welcomePageNum, - items: tablist - .asMap() - .entries - .map((i) => ComboBoxItem( - child: Text(i.value), - value: i.key, - )) - .toList(), - onChanged: (index) async { - await userSetting.setWelcomePageNum(index!); - }, - ); - }), - ), - ListTile( - title: Text(I18n.of(context).layout_mode), - trailing: Observer(builder: (_) { - const tablist = [ - "V:H", - "V:V", - "H:H", - ]; - return ComboBox( - value: userSetting.padMode, - items: tablist - .asMap() - .entries - .map((i) => ComboBoxItem( - child: Text(i.value), - value: i.key, - )) - .toList(), - onChanged: (index) async { - await userSetting.setPadMode(index!); - }, - ); - }), - ), - ListTile(title: Text(I18n.of(context).crosscount)), - ListTile( - leading: Icon(FluentIcons.column), - trailing: Observer(builder: (_) { - const tablist = [ - ' 2 ', - ' 3 ', - ' 4 ', - "Adapt", - ]; - return ComboBox( - value: userSetting.crossAdapt ? 3 : userSetting.crossCount - 2, - items: tablist - .asMap() - .entries - .map((i) => ComboBoxItem( - child: Text(i.value), - value: i.key, - )) - .toList(), - onChanged: (index) async { - if (index == 3) { - await userSetting.setCrossAdapt(true); - Leader.push( - context, - SettingCrossAdpaterPage( - h: false, - )); - return; - } - await userSetting.setCrossAdapt(false); - await userSetting.setCrossCount(index! + 2); - BotToast.showText(text: I18n.of(context).need_to_restart_app); - }, - ); - }), - ), - ListTile( - leading: Icon(FluentIcons.dock_left), - trailing: Observer(builder: (_) { - const tablist = [ - ' 2 ', - ' 3 ', - ' 4 ', - "Adapt", - ]; - return ComboBox( - value: userSetting.hCrossAdapt ? 3 : userSetting.hCrossCount - 2, - items: tablist - .asMap() - .entries - .map((i) => ComboBoxItem( - child: Text(i.value), - value: i.key, - )) - .toList(), - onChanged: (index) async { - if (index == 3) { - await userSetting.setHCrossAdapt(true); - Leader.push( - context, - SettingCrossAdpaterPage( - h: true, - )); - return; - } - userSetting.setHCrossCount(index! + 2); - BotToast.showText(text: I18n.of(context).need_to_restart_app); - }, - ); - }), - ), - Observer(builder: (_) { - final targetValue = - userSetting.maxRunningTask < 1 ? 1 : userSetting.maxRunningTask; - return ListTile( - title: Text( - "${I18n.of(context).max_download_task_running_count} $targetValue"), - subtitle: Slider( - value: targetValue.toDouble(), - label: '${targetValue}', - min: 1, - max: 10, - divisions: 10, - onChanged: (v) { - int value = v.toInt(); - userSetting.setMaxRunningTask(value); - }), - ); - }), - // Padding( - // padding: const EdgeInsets.all(8.0), - // child: Card( - // child: Observer(builder: (_) { - // return ListTile( - // title: Text(I18n.of(context).special_shaped_screen), - // subtitle: Text('--v--'), - // trailing: ToggleSwitch( - // checked: userSetting.isBangs, - // onChanged: (value) async { - // userSetting.setIsBangs(value); - // })); - // }), - // ), - // ), - Observer(builder: (_) { - return ListTile( - title: Text('H是不行的!'), - trailing: ToggleSwitch( - checked: userSetting.hIsNotAllow, - onChanged: (value) async { - if (!value) BotToast.showText(text: 'H是可以的!(ˉ﹃ˉ)'); - userSetting.setHIsNotAllow(value); - })); - }), - // Padding( - // padding: const EdgeInsets.all(8.0), - // child: Card( - // child: Observer(builder: (_) { - // return ListTile( - // title: Text(I18n.of(context).return_again_to_exit), - // trailing: ToggleSwitch( - // checked: userSetting.isReturnAgainToExit, - // onChanged: (value) async { - // userSetting.setIsReturnAgainToExit(value); - // })); - // }), - // ), - // ), - Observer(builder: (_) { - return ListTile( - title: Text(I18n.of(context).follow_after_star), - trailing: ToggleSwitch( - checked: userSetting.followAfterStar, - onChanged: (value) async { - userSetting.setFollowAfterStar(value); - })); - }), - Observer( - builder: (context) { - return ListTile( - onPressed: () { - Leader.push( - context, - CopyTextPage(), - title: Text(I18n.of(context).share_info_format), - icon: Icon(FluentIcons.forward), - ); - }, - title: Text(I18n.of(context).share_info_format), - trailing: Icon(FluentIcons.chevron_right), - ); - }, - ), - if (_widgetTypeIndex != -1) - Padding( - padding: EdgeInsets.all(8.0), - child: Card( - child: Column( - children: [ - Padding( - child: Text("App widget type"), - padding: EdgeInsets.all(16), - ), - Observer(builder: (_) { - var tablist = [ - I18n.of(context).rank, - I18n.of(context).news, - I18n.of(context).recommend, - ]; - return ComboBox( - value: _widgetTypeIndex, - items: tablist - .asMap() - .entries - .map((i) => ComboBoxItem( - child: Text(i.value), - value: i.key, - )) - .toList(), - onChanged: (index) async { - final type = _typeList[index!]; - await _pref?.setString("widget_illust_type", type); - }, - ); - }) - ], - )), - ), - ], - ); - } - - void _buildLanguageTranlators() { - final langsponsors = Languages[userSetting.languageNum].sponsors; - _languageTranlator = Row( - children: [ - for (final langsponsor in langsponsors) - PixEzButton( - onPressed: () { - try { - launchUrl(Uri.parse(langsponsor.uri)); - } catch (e) {} - }, - child: Row( - children: [ - CircleAvatar( - backgroundImage: NetworkImage(langsponsor.avatar), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text(langsponsor.name), - ) - ], - ), - ), - ], - ); - } -} diff --git a/lib/fluent/page/history/history_page.dart b/lib/fluent/page/history/history_page.dart deleted file mode 100644 index 46f8b594a..000000000 --- a/lib/fluent/page/history/history_page.dart +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:pixez/fluent/component/context_menu.dart'; -import 'package:pixez/fluent/component/pixez_button.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/illust_persist.dart'; -import 'package:pixez/fluent/page/picture/illust_lighting_page.dart'; -import 'package:pixez/page/history/history_store.dart'; -import 'package:pixez/page/picture/illust_store.dart'; - -class HistoryPage extends StatefulHookConsumerWidget { - const HistoryPage({super.key}); - - @override - ConsumerState createState() => _HistoryPageState(); -} - -class _HistoryPageState extends ConsumerState { - late TextEditingController _textEditingController; - - Widget buildBody(List data) => Builder( - builder: (context) { - final count = - (MediaQuery.of(context).orientation == Orientation.portrait) - ? userSetting.crossCount - : userSetting.hCrossCount; - - final reIllust = data.reversed.toList(); - if (reIllust.isEmpty) return Container(); - - return GridView.builder( - itemCount: reIllust.length, - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: count), - itemBuilder: (context, index) => _HistoryItem( - reIllust: reIllust, - index: index, - ), - ); - }, - ); - - @override - void initState() { - _textEditingController = TextEditingController(); - super.initState(); - } - - @override - void dispose() { - _textEditingController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - final data = ref.watch(historyProvider.select((state) => state.data)); - return ScaffoldPage( - header: PageHeader( - title: Text(I18n.of(context).history), - commandBar: TextBox( - controller: _textEditingController, - onChanged: (word) { - if (word.trim().isNotEmpty) { - ref.read(historyProvider.notifier).search(word.trim()); - } else { - ref.read(historyProvider.notifier).fetch(); - } - }, - placeholder: I18n.of(context).search_word_hint, - prefix: IconButton( - icon: Icon(FluentIcons.delete), - onPressed: () async { - final result = await showDialog( - context: context, - useRootNavigator: false, - builder: (context) => ContentDialog( - title: Text('Clear All History?'), - actions: [ - Button( - child: Text(I18n.of(context).cancel), - onPressed: () => Navigator.of(context).pop(), - ), - FilledButton( - child: Text(I18n.of(context).ok), - onPressed: () => Navigator.of(context).pop('ok'), - ), - ], - ), - ); - if (result == 'ok') _cleanAll(context); - }, - ), - suffix: IconButton( - icon: Icon(FluentIcons.clear), - onPressed: () { - _textEditingController.clear(); - }, - ), - ), - ), - content: buildBody(data), - ); - } - - Future _cleanAll(BuildContext context) async { - final result = await showDialog( - context: context, - builder: (context) { - return ContentDialog( - title: Text("${I18n.of(context).delete} ${I18n.of(context).all}?"), - actions: [ - HyperlinkButton( - child: Text(I18n.of(context).cancel), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - HyperlinkButton( - child: Text(I18n.of(context).ok), - onPressed: () { - Navigator.of(context).pop("OK"); - }, - ), - ], - ); - }); - if (result == "OK") { - ref.read(historyProvider.notifier).deleteAll(); - } - } -} - -class _HistoryItem extends HookConsumerWidget { - final List reIllust; - final int index; - - const _HistoryItem({required this.reIllust, required this.index}); - - @override - Widget build(BuildContext context, WidgetRef ref) { - return ContextMenu( - child: PixEzButton( - child: PixivImage(reIllust[index].pictureUrl), - onPressed: () { - Leader.push( - context, - IllustLightingPage( - id: reIllust[index].illustId, - store: IllustStore(reIllust[index].illustId, null)), - icon: Icon(FluentIcons.picture), - title: Text( - I18n.of(context).illust_id + ': ${reIllust[index].illustId}'), - ); - }, - ), - items: [ - MenuFlyoutItem( - text: Text(I18n.of(context).delete), - onPressed: () async { - await showDialog( - context: context, - builder: (context) { - return ContentDialog( - title: Text("${I18n.of(context).delete}?"), - actions: [ - HyperlinkButton( - child: Text(I18n.of(context).cancel), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - HyperlinkButton( - child: Text(I18n.of(context).ok), - onPressed: () { - ref - .read(historyProvider.notifier) - .delete(reIllust[index].illustId); - Navigator.of(context).pop(); - }, - ), - ], - ); - }, - ); - }, - ) - ], - ); - } -} diff --git a/lib/fluent/page/login/login_page.dart b/lib/fluent/page/login/login_page.dart deleted file mode 100644 index 3d9a912ee..000000000 --- a/lib/fluent/page/login/login_page.dart +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/fluent/page/login/token_page.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/network/oauth_client.dart'; -import 'package:pixez/fluent/page/about/about_page.dart'; -import 'package:pixez/fluent/page/hello/setting/setting_quality_page.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class LoginPage extends StatefulWidget { - @override - _LoginPageState createState() => _LoginPageState(); -} - -class _LoginPageState extends State { - TextEditingController userNameController = TextEditingController(); - TextEditingController passWordController = TextEditingController(); - - @override - void initState() { - super.initState(); - } - - @override - void dispose() { - userNameController.dispose(); - passWordController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - bottomBar: CommandBar( - primaryItems: [ - CommandBarButton( - icon: Icon(FluentIcons.settings), - onPressed: () { - Leader.push( - context, - SettingQualityPage(), - icon: Icon(FluentIcons.settings), - title: Text(I18n.of(context).quality_setting), - ); - }), - CommandBarButton( - icon: Icon(FluentIcons.message), - onPressed: () { - Leader.push( - context, - AboutPage(), - icon: Icon(FluentIcons.message), - title: Text(I18n.of(context).about), - ); - }) - ], - ), - content: Builder(builder: (context) { - return _buildBody(context); - })); - } - - Widget _buildBody(BuildContext context) { - return FluentTheme( - data: FluentThemeData( - accentColor: FluentTheme.of(context).accentColor, - brightness: FluentTheme.of(context).brightness), - child: Padding( - padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), - child: SingleChildScrollView( - padding: EdgeInsets.all(0), - child: Column( - children: [ - Container( - height: 20, - ), - Image.asset( - 'assets/images/icon.png', - height: 80, - width: 80, - ), - Padding( - padding: EdgeInsets.only(bottom: 20), - child: Container( - padding: EdgeInsets.symmetric(horizontal: 20), - child: AutofillGroup( - child: Column( - children: [ - Padding( - padding: EdgeInsets.all(10), - ), - FilledButton( - child: Text( - I18n.of(context).login, - ), - onPressed: () async { - try { - String url = - await OAuthClient.generateWebviewUrl(); - await launchUrl(Uri.parse(url)); - } catch (e) {} - }), - FilledButton( - onPressed: () async { - try { - String url = - await OAuthClient.generateWebviewUrl( - create: true); - await launchUrl(Uri.parse(url)); - } catch (e) {} - }, - child: Text(I18n.of(context).dont_have_account), - ), - Button( - onPressed: () => showDialog( - context: context, - builder: (context) => TokenPage(), - useRootNavigator: false, - ), - child: Text('Token'), - ), - HyperlinkButton( - child: Text( - I18n.of(context).terms, - ), - onPressed: () async { - final url = - 'https://www.pixiv.net/terms/?page=term'; - try { - await launchUrl(Uri.parse(url)); - } catch (e) {} - }, - ), - ], - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.stretch, - ), - ), - ), - ), - ], - )), - ), - ); - } -} diff --git a/lib/fluent/page/login/token_page.dart b/lib/fluent/page/login/token_page.dart deleted file mode 100644 index 76fd9dafb..000000000 --- a/lib/fluent/page/login/token_page.dart +++ /dev/null @@ -1,122 +0,0 @@ -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/account.dart'; -import 'package:pixez/network/oauth_client.dart'; - -class TokenPage extends StatefulWidget { - @override - _TokenPageState createState() => _TokenPageState(); -} - -class _TokenPageState extends State { - String errorMessage = ""; - TextEditingController userNameController = TextEditingController(); - - @override - void dispose() { - userNameController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return ContentDialog( - constraints: const BoxConstraints( - maxWidth: 368.0, - maxHeight: 300.0, - ), - title: const Text('Token'), - content: Padding( - padding: const EdgeInsets.all(8.0), - child: ListView( - children: [ - InfoLabel( - label: 'Token', - child: TextFormBox( - maxLines: 1, - prefix: const Padding( - padding: EdgeInsets.symmetric(horizontal: 8), - child: const Icon(FluentIcons.password_field), - ), - placeholder: 'token', - controller: userNameController, - autofillHints: [AutofillHints.username], - ), - ), - Visibility( - visible: errorMessage.isNotEmpty, - child: Padding( - padding: - const EdgeInsets.symmetric(vertical: 4.0, horizontal: 0), - child: Container( - decoration: BoxDecoration( - color: FluentTheme.of(context).accentColor, - borderRadius: BorderRadius.all(Radius.circular(4.0)), - ), - padding: EdgeInsets.all(4.0), - child: Text( - errorMessage, - textAlign: TextAlign.start, - style: TextStyle(color: Colors.white), - ), - ), - ), - ) - ], - ), - ), - actions: [ - Button( - child: Text(I18n.of(context).cancel), - onPressed: Navigator.of(context).pop, - ), - FilledButton( - onPressed: () async { - if (userNameController.text.isEmpty) return; - try { - String token = userNameController.text.toString(); - var response1 = - await oAuthClient.postRefreshAuthToken(refreshToken: token); - AccountResponse accountResponse = - Account.fromJson(response1.data).response; - final user = accountResponse.user; - AccountProvider accountProvider = new AccountProvider(); - await accountProvider.open(); - await accountProvider.deleteByUserId(user.id); - var accountPersist = AccountPersist( - userId: user.id, - userImage: user.profileImageUrls.px170x170, - accessToken: accountResponse.accessToken, - refreshToken: accountResponse.refreshToken, - deviceToken: "", - passWord: "no more", - name: user.name, - account: user.account, - mailAddress: user.mailAddress, - isPremium: user.isPremium ? 1 : 0, - xRestrict: user.xRestrict, - isMailAuthorized: user.isMailAuthorized ? 1 : 0); - await accountProvider.insert(accountPersist); - await accountStore.fetch(); - Leader.pushUntilHome(context); - } catch (e) { - setState(() { - errorMessage = e.toString(); - }); - } - }, - child: Text("Next"), - ), - ], - ); - } - - int bti(bool bool) { - if (bool) { - return 1; - } else - return 0; - } -} diff --git a/lib/fluent/page/network/network_page.dart b/lib/fluent/page/network/network_page.dart deleted file mode 100644 index 06f783330..000000000 --- a/lib/fluent/page/network/network_page.dart +++ /dev/null @@ -1,198 +0,0 @@ -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; - -class NetworkPage extends StatefulWidget { - final bool? automaticallyImplyLeading; - - const NetworkPage({Key? key, this.automaticallyImplyLeading}) - : super(key: key); - - @override - _NetworkPageState createState() => _NetworkPageState(); -} - -class _NetworkPageState extends State { - late TextEditingController _textEditingController; - - @override - void initState() { - _textEditingController = TextEditingController( - text: userSetting.pictureSource, - ); - super.initState(); - } - - @override - void dispose() { - _textEditingController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - content: Observer(builder: (_) { - return ListView( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - I18n.of(context).network, - style: FluentTheme.of(context).typography.title, - textAlign: TextAlign.center, - ), - ), - Text( - "tip:如果不能载图,可以尝试切换图床,你可以在设置页重新回到这里", - textAlign: TextAlign.center, - ), - const Padding(padding: EdgeInsets.symmetric(vertical: 5.0)), - Center( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Observer(builder: (_) { - return ToggleSwitch( - checked: userSetting.disableBypassSni, - content: Text(I18n.of(context).disable_sni_bypass), - onChanged: (value) async { - if (value) { - final result = await showDialog( - context: context, - useRootNavigator: false, - builder: (_) { - return ContentDialog( - title: Text(I18n.of(context).please_note_that), - content: Text( - I18n.of(context).please_note_that_content, - ), - actions: [ - Button( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text(I18n.of(context).cancel), - ), - Button( - onPressed: () { - Navigator.of(context).pop('OK'); - }, - child: Text(I18n.of(context).ok), - ), - ], - ); - }, - ); - if (result != 'OK') return; - } - - userSetting.setDisableBypassSni(value); - }); - }), - )), - Center(child: Text(I18n.of(context).disable_sni_bypass_message)), - Center( - child: Visibility( - visible: !userSetting.disableBypassSni, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Card( - child: Column( - children: [ - Text( - I18n.of(context).image_site, - style: TextStyle( - color: FluentTheme.of(context).accentColor), - ), - IconButton( - icon: Icon(FluentIcons.refresh), - onPressed: () async { - userSetting.setPictureSource(ImageHost); - splashStore.setHost(ImageHost); - splashStore.helloWord = "= w ="; - splashStore.maybeFetch(); - }, - ), - ComboBox( - value: switch (userSetting.pictureSource) { - ImageHost => 0, - ImageCatHost => 1, - _ => 2, - }, - onChanged: (value) {}, - items: [ - ComboBoxItem( - child: Text(I18n.of(context).default_title), - value: 0, - onTap: () { - userSetting.setPictureSource(ImageHost); - splashStore.setHost(ImageHost); - splashStore.helloWord = "= w ="; - splashStore.maybeFetch(); - }, - ), - ComboBoxItem( - child: Text(ImageCatHost), - value: 1, - onTap: () { - userSetting.setPictureSource(ImageCatHost); - splashStore.setHost(ImageCatHost); - }, - ), - ComboBoxItem( - child: Text('Custom Host'), - value: 2, - onTap: () {}, - ), - ], - ), - if (switch (userSetting.pictureSource) { - ImageHost => false, - ImageCatHost => false, - _ => true, - }) - InfoLabel( - label: 'Custom Host', - child: TextBox( - maxLines: 1, - placeholder: 'Host', - controller: _textEditingController, - suffix: IconButton( - onPressed: () async { - if (_textEditingController.text.isEmpty) - return; - if (_textEditingController.text - .trim() - .contains(" ")) { - displayInfoBar(context, - builder: (context, VoidCallback) => - InfoBar( - title: Text('illegal'), - )); - return; - } - await userSetting.setPictureSource( - _textEditingController.text.trim()); - FocusScope.of(context) - .requestFocus(FocusNode()); - }, - icon: Icon( - FluentIcons.check_mark, - ), - ), - ), - ), - ], - ), - ), - ), - ), - ), - ], - ); - }), - ); - } -} diff --git a/lib/fluent/page/network/network_select.dart b/lib/fluent/page/network/network_select.dart deleted file mode 100644 index 4f2653b79..000000000 --- a/lib/fluent/page/network/network_select.dart +++ /dev/null @@ -1,50 +0,0 @@ -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; - -class NetworkSelectPage extends StatefulWidget { - @override - _NetworkSelectPageState createState() => _NetworkSelectPageState(); -} - -class _NetworkSelectPageState extends State - with TickerProviderStateMixin { - @override - Widget build(BuildContext context) { - return Observer(builder: (context) { - return ScaffoldPage( - content: SafeArea( - child: ListView( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - I18n.of(context).network_question, - style: FluentTheme.of(context).typography.title, - textAlign: TextAlign.center, - ), - ), - Container( - height: 24, - ), - Center( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: ToggleSwitch( - checked: userSetting.disableBypassSni, - onChanged: (v) async => - await userSetting.setDisableBypassSni(v), - content: userSetting.disableBypassSni - ? const Text("Nope") - : const Text("Yes"), - ), - ), - ), - ], - ), - ), - ); - }); - } -} diff --git a/lib/fluent/page/network/network_setting_page.dart b/lib/fluent/page/network/network_setting_page.dart deleted file mode 100644 index ce050fd80..000000000 --- a/lib/fluent/page/network/network_setting_page.dart +++ /dev/null @@ -1,133 +0,0 @@ -import 'dart:io'; - -import 'package:dio/dio.dart'; -import 'package:dio/io.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:path_provider/path_provider.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/er/hoster.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/network/api_client.dart'; - -class NetworkSettingPage extends StatefulWidget { - @override - _NetworkSettingPageState createState() => _NetworkSettingPageState(); -} - -class _NetworkSettingPageState extends State { - int apiStatus = 0; - int imgStatus = 0; - String message = ""; - late String host; - late TextEditingController editingController; - - @override - void initState() { - super.initState(); - host = "210.140.92.140"; - editingController = new TextEditingController(); - editingController.addListener(() { - host = editingController.text.toString(); - }); - initNetCheck(); - } - - initNetCheck() async { - _apiCheck(); - _imgCheck(); - } - - _apiCheck() async { - try { - await apiClient.walkthroughIllusts(); - setState(() { - apiStatus = 1; - }); - } catch (e) { - setState(() { - apiStatus = 2; - }); - } - } - - _imgCheck() async { - try { - String url = - "https://i.pximg.net/c/360x360_70/img-master/img/2016/04/29/03/33/27/56585648_p0_square1200.jpg"; - var dio = Dio(BaseOptions(headers: Hoster.header(url: url))); - String trueUrl = url.replaceFirst(ImageHost, host); - dio.httpClientAdapter = IOHttpClientAdapter() - ..createHttpClient = () { - return HttpClient() - ..idleTimeout = Duration(seconds: 3) - ..badCertificateCallback = - (X509Certificate cert, String host, int port) => true; - }; - await dio - .download(trueUrl, (await getTemporaryDirectory()).path + "/s.png", - onReceiveProgress: (min, max) { - throw ok(); - }, deleteOnError: true); - } catch (e) { - if (e is ok) { - setState(() { - apiStatus = 1; - }); - } else - setState(() { - message = e.toString(); - apiStatus = 2; - }); - } - } - - @override - Widget build(BuildContext context) { - return ContentDialog( - title: Text("网络诊断"), - content: ListView( - children: [ - ListTile( - title: Text("app-api.pixiv.net"), - subtitle: Text("Host:" + ApiClient.BASE_API_URL_HOST), - trailing: _buildCheckIcon(apiStatus), - ), - ListTile( - title: Text(ImageHost), - subtitle: Text("Host:" + splashStore.host), - trailing: _buildCheckIcon(imgStatus), - ), - TextBox( - controller: editingController, - ), - HyperlinkButton( - onPressed: () { - host = editingController.text; - _imgCheck(); - }, - child: Text("apply")), - Text(message), - ], - ), - actions: [ - FilledButton( - child: Text(I18n.of(context).ok), - onPressed: Navigator.of(context).pop, - ), - ], - ); - } - - Widget _buildCheckIcon(int status) { - if (status == 0) { - return ProgressRing(); - } else if (status == 1) { - return Icon(FluentIcons.check_mark); - } else { - return Icon(FluentIcons.error); - } - } -} - -class ok {} diff --git a/lib/fluent/page/painter/painter_list.dart b/lib/fluent/page/painter/painter_list.dart deleted file mode 100644 index 7f4ec0917..000000000 --- a/lib/fluent/page/painter/painter_list.dart +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:easy_refresh/easy_refresh.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/component/pixez_default_header.dart'; -import 'package:pixez/fluent/component/painer_card.dart'; -import 'package:pixez/utils.dart'; -import 'package:pixez/lighting/lighting_store.dart'; -import 'package:pixez/page/painter/painter_list_store.dart'; - -class PainterList extends StatefulWidget { - final FutureGet futureGet; - final bool isNovel; - final Widget? header; - - const PainterList( - {Key? key, required this.futureGet, this.isNovel = false, this.header}) - : super(key: key); - - @override - _PainterListState createState() => _PainterListState(); -} - -class _PainterListState extends State { - late EasyRefreshController _easyRefreshController; - late PainterListStore _painterListStore; - late ScrollController _scrollController; - - @override - void initState() { - _scrollController = ScrollController(); - _easyRefreshController = EasyRefreshController( - controlFinishLoad: true, controlFinishRefresh: true); - _painterListStore = - PainterListStore(_easyRefreshController, widget.futureGet); - - // Load More Detecter - initializeScrollController(_scrollController, _painterListStore.next); - super.initState(); - _painterListStore.fetch(); - } - - @override - void didUpdateWidget(PainterList oldWidget) { - super.didUpdateWidget(oldWidget); - if (oldWidget.futureGet != widget.futureGet) { - _painterListStore.source = widget.futureGet; - _easyRefreshController.resetFooter(); - _painterListStore.fetch(); - if (_painterListStore.users.isNotEmpty) _scrollController.jumpTo(0.0); - } - } - - @override - void dispose() { - _scrollController.dispose(); - _easyRefreshController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Observer(builder: (_) { - return EasyRefresh( - controller: _easyRefreshController, - header: PixezDefault.header(context), - onLoad: () => _painterListStore.next(), - onRefresh: () => _painterListStore.fetch(), - child: _painterListStore.users.isNotEmpty - ? LayoutBuilder( - builder: (context, constraints) { - final width = constraints.maxWidth; - return CustomScrollView( - controller: _scrollController, - slivers: [ - if (widget.header != null) - SliverToBoxAdapter( - child: widget.header, - ), - SliverGrid.builder( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: (width / 300).floor(), - childAspectRatio: 1.60, - ), - itemBuilder: (context, index) { - return _itemBuilder(index); - }, - itemCount: _painterListStore.users.length, - ), - ], - ); - }, - ) - : Container(), - ); - }); - } - - Widget _itemBuilder(int index) { - final user = _painterListStore.users[index]; - if (widget.isNovel) - return PainterCard( - user: user, - isNovel: widget.isNovel, - ); - return PainterCard( - user: user, - ); - } -} diff --git a/lib/fluent/page/picture/illust_detail_body.dart b/lib/fluent/page/picture/illust_detail_body.dart deleted file mode 100644 index d1093c956..000000000 --- a/lib/fluent/page/picture/illust_detail_body.dart +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter/gestures.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:intl/intl.dart'; -import 'package:pixez/fluent/component/context_menu.dart'; -import 'package:pixez/fluent/component/painter_avatar.dart'; -import 'package:pixez/fluent/component/selectable_html.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/models/illust.dart'; -import 'package:pixez/fluent/page/comment/comment_page.dart'; -import 'package:pixez/fluent/page/picture/row_card.dart'; -import 'package:pixez/page/picture/illust_detail_store.dart'; - -class GestureMe extends GestureRecognizer { - @override - void acceptGesture(int pointer) {} - - @override - String get debugDescription => throw UnimplementedError(); - - @override - void rejectGesture(int pointer) {} -} - -class IllustDetailBody extends StatelessWidget { - final Illusts illust; - - IllustDetailBody({Key? key, required this.illust}) : super(key: key); - - Widget colorText(String text, BuildContext context) => Text( - text, - style: TextStyle(color: FluentTheme.of(context).accentColor), - ); - - Widget _buildNameAvatar( - BuildContext context, Illusts illust, IllustDetailStore _store) { - return ContextMenu( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Padding( - child: Container( - height: 70, - width: 70, - child: Stack( - children: [ - Center( - child: SizedBox( - height: 70, - width: 70, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: _store.isFollow - ? Colors.yellow - : FluentTheme.of(context).accentColor, - ), - ), - ), - ), - Center( - child: PainterAvatar( - url: illust.user.profileImageUrls.medium, - id: illust.user.id, - ), - ), - ], - ), - ), - padding: EdgeInsets.all(8.0)), - Expanded( - child: Padding( - padding: EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - illust.title, - style: - TextStyle(color: FluentTheme.of(context).accentColor), - ), - Container( - height: 4.0, - ), - Text( - illust.user.name, - style: FluentTheme.of(context).typography.body, - ), - Text( - toShortTime(illust.createDate), - style: FluentTheme.of(context).typography.caption, - ), - ], - ), - ), - ), - ], - ), - items: [ - MenuFlyoutItem( - text: Text(I18n.of(context).follow), - onPressed: () async { - await _store.followUser(); - }, - ) - ], - ); - } - - String toShortTime(String dateString) { - try { - var formatter = new DateFormat('yyyy-MM-dd HH:mm:ss'); - return formatter.format(DateTime.parse(dateString)); - } catch (e) { - return dateString; - } - } - - @override - Widget build(BuildContext context) { - final IllustDetailStore _store = IllustDetailStore(illust); - return SelectionArea( - child: Observer(builder: (context) { - return Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - _buildNameAvatar(context, illust, _store), - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text(I18n.of(context).illust_id), - Container( - width: 10.0, - ), - colorText(illust.id.toString(), context), - Container( - width: 20.0, - ), - Text(I18n.of(context).pixel), - Container( - width: 10.0, - ), - colorText("${illust.width}x${illust.height}", context) - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text(I18n.of(context).total_view), - Container( - width: 10.0, - ), - colorText(illust.totalView.toString(), context), - Container( - width: 20.0, - ), - Text(I18n.of(context).total_bookmark), - Container( - width: 10.0, - ), - colorText("${illust.totalBookmarks}", context) - ], - ), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.center, - spacing: 2, // gap between adjacent chips - runSpacing: 0, // gap between lines - children: [ - if (illust.illustAIType == 2) - Text("${I18n.of(context).ai_generated}", - style: FluentTheme.of(context) - .typography - .caption! - .copyWith( - color: FluentTheme.of(context).accentColor)), - for (var f in illust.tags) buildRow(context, f) - ], - ), - ), - Card( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: SelectableHtml( - data: illust.caption.isEmpty ? "~" : illust.caption, - ), - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: HyperlinkButton( - child: Text(I18n.of(context).view_comment, - textAlign: TextAlign.center, - style: FluentTheme.of(context).typography.body!), - onPressed: () { - Leader.push( - context, - CommentPage( - id: illust.id, - ), - icon: Icon(FluentIcons.comment), - title: Text(I18n.of(context).view_comment), - ); - }, - ), - ) - ], - ), - ); - }), - ); - } - - Widget buildRow(BuildContext context, Tags f) { - return RowCard(f); - } -} diff --git a/lib/fluent/page/picture/illust_items_page.dart b/lib/fluent/page/picture/illust_items_page.dart deleted file mode 100644 index 5dae3caf3..000000000 --- a/lib/fluent/page/picture/illust_items_page.dart +++ /dev/null @@ -1,941 +0,0 @@ -import 'package:bot_toast/bot_toast.dart'; -import 'package:easy_refresh/easy_refresh.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/clipboard_plugin.dart'; -import 'package:pixez/fluent/component/ban_page.dart'; -import 'package:pixez/fluent/component/context_menu.dart'; -import 'package:pixez/fluent/component/painter_avatar.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/fluent/component/selectable_html.dart'; -import 'package:pixez/component/null_hero.dart'; -import 'package:pixez/component/star_icon.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/er/lprinter.dart'; -import 'package:pixez/exts.dart'; -import 'package:pixez/utils.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/ban_illust_id.dart'; -import 'package:pixez/models/illust.dart'; -import 'package:pixez/fluent/page/comment/comment_page.dart'; -import 'package:pixez/fluent/page/picture/picture_list_page.dart'; -import 'package:pixez/fluent/page/picture/row_card.dart'; -import 'package:pixez/fluent/page/picture/tag_for_illust_page.dart'; -import 'package:pixez/fluent/page/picture/ugoira_loader.dart'; -import 'package:pixez/fluent/page/user/users_page.dart'; -import 'package:pixez/fluent/page/zoom/photo_zoom_page.dart'; -import 'package:pixez/page/picture/illust_about_store.dart'; -import 'package:pixez/page/picture/illust_store.dart'; -import 'package:pixez/page/user/user_store.dart'; -import 'package:share_plus/share_plus.dart'; - -abstract class IllustItemsPage extends StatefulWidget { - final int id; - final String? heroString; - final IllustStore? store; - - const IllustItemsPage({ - Key? key, - required this.id, - this.heroString, - this.store, - }) : super(key: key); -} - -abstract class IllustItemsPageState extends State - with AutomaticKeepAliveClientMixin { - UserStore? userStore; - late IllustStore illustStore; - late IllustAboutStore aboutStore; - final EasyRefreshController refreshController = EasyRefreshController( - controlFinishLoad: true, controlFinishRefresh: true); - final ScrollController scrollController = ScrollController(); - bool tempView = false; - - @override - void initState() { - // widget.relay.more = - // () => buildshowBottomSheet(context, _illustStore.illusts!); - - illustStore = widget.store ?? IllustStore(widget.id, null); - illustStore.fetch(); - aboutStore = IllustAboutStore(widget.id, refreshController); - - initializeScrollController(scrollController, aboutStore.next); - super.initState(); - } - - @override - void didUpdateWidget(covariant IllustItemsPage oldWidget) { - super.didUpdateWidget(oldWidget); - if (oldWidget.store != widget.store) { - illustStore = widget.store ?? IllustStore(widget.id, null); - illustStore.fetch(); - aboutStore = IllustAboutStore(widget.id, refreshController); - LPrinter.d("state change"); - } - } - - void _loadAbout() { - if (mounted && - scrollController.hasClients && - scrollController.offset + 180 >= - scrollController.position.maxScrollExtent && - aboutStore.illusts.isEmpty) aboutStore.next(); - } - - @override - void dispose() { - illustStore.dispose(); - scrollController.dispose(); - refreshController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - super.build(context); - return ScaffoldPage( - content: Observer(builder: (_) { - if (!tempView) - for (var i in muteStore.banillusts) { - if (i.illustId == widget.id.toString()) { - return BanPage( - name: "${I18n.of(context).illust}\n${i.name}\n", - onPressed: () { - setState(() { - tempView = true; - }); - }, - ); - } - } - if (!tempView && illustStore.illusts != null) { - for (var j in muteStore.banUserIds) { - if (j.userId == illustStore.illusts!.user.id.toString()) { - return BanPage( - name: "${I18n.of(context).painter}\n${j.name}\n", - onPressed: () { - setState(() { - tempView = true; - }); - }, - ); - } - } - for (var t in muteStore.banTags) { - for (var t1 in illustStore.illusts!.tags) { - if (t.name == t1.name) - return BanPage( - name: "${I18n.of(context).tag}\n${t.name}\n", - onPressed: () { - setState(() { - tempView = true; - }); - }, - ); - } - } - } - return Stack( - alignment: AlignmentDirectional.bottomEnd, - children: [ - buildContent(context, illustStore.illusts), - Container( - margin: EdgeInsets.only(right: 8.0, bottom: 8.0), - child: ContextMenu( - child: ButtonTheme( - child: IconButton( - icon: Observer( - builder: (_) => StarIcon( - state: illustStore.state, - ), - ), - onPressed: illustStore.star, - ), - data: ButtonThemeData( - iconButtonStyle: ButtonStyle( - backgroundColor: ButtonState.all( - FluentTheme.of(context).inactiveBackgroundColor, - ), - shadowColor: ButtonState.all( - FluentTheme.of(context).shadowColor, - ), - shape: ButtonState.all(CircleBorder()), - ), - ), - ), - items: [ - MenuFlyoutItem( - text: Text(I18n.of(context).favorited_tag), - onPressed: () async { - await showBookMarkTag(); - }, - ), - ], - ), - ) - ], - ); - }), - ); - } - - Widget colorText(String text, BuildContext context) => Container( - child: Text( - text, - style: TextStyle(color: FluentTheme.of(context).accentColor), - ), - ); - - Widget buildContent(BuildContext context, Illusts? data); - - SliverGrid buildRecom() { - return SliverGrid( - delegate: SliverChildBuilderDelegate((BuildContext context, int index) { - var list = aboutStore.illusts - .map((element) => IllustStore(element.id, element)) - .toList(); - return MoreItem( - index, - list, - aboutStore, - ); - }, childCount: aboutStore.illusts.length), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3)); - } - - List buildPhotoList(Illusts data, bool centerType, double height) { - return [ - if (data.type == "ugoira") - SliverFillRemaining( - child: Center( - child: NullHero( - tag: widget.heroString, - child: UgoiraLoader( - id: widget.id, - illusts: data, - ), - ), - ), - ), - if (data.type != "ugoira") - data.pageCount == 1 - ? (centerType - ? SliverFillRemaining( - child: buildPicture(data, height), - ) - : SliverList( - delegate: SliverChildBuilderDelegate((context, index) { - return buildPicture(data, height); - }, childCount: 1))) - : SliverList( - delegate: SliverChildBuilderDelegate( - (BuildContext context, int index) { - return IllustItem( - index, - data, - widget, - icon: buildIllustsItem(index, data, height), - onMultiSavePressed: () async { - await showMutiChoiceDialog(data, context); - }, - ); - }, childCount: data.metaPages.length), - ), - ]; - } - - Widget buildPicture(Illusts data, double height) { - return Center(child: Builder( - builder: (BuildContext context) { - String url = userSetting.pictureQuality == 1 - ? data.imageUrls.large - : data.imageUrls.medium; - if (data.type == "manga") { - if (userSetting.mangaQuality == 0) - url = data.imageUrls.medium; - else if (userSetting.mangaQuality == 1) - url = data.imageUrls.large; - else - url = data.metaSinglePage!.originalImageUrl!; - } - Widget placeWidget = Container(height: height); - return LayoutBuilder( - builder: (context, constraints) => IllustItem( - 0, - data, - widget, - icon: NullHero( - tag: widget.heroString, - child: PixivImage( - url, - fade: false, - width: constraints.maxWidth, - placeWidget: (url != data.imageUrls.medium) - ? PixivImage( - data.imageUrls.medium, - width: constraints.maxWidth, - placeWidget: placeWidget, - fade: false, - ) - : placeWidget, - ), - ), - onMultiSavePressed: () async { - await showMutiChoiceDialog(data, context); - }, - ), - ); - }, - )); - } - - Center buildErrorContent(BuildContext context) { - return Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text(':(', style: FluentTheme.of(context).typography.title), - ), - Text( - '${illustStore.errorMessage}', - maxLines: 5, - ), - FilledButton( - onPressed: () { - illustStore.fetch(); - }, - child: Text(I18n.of(context).refresh), - ) - ], - ), - ); - } - - Widget buildIllustsItem(int index, Illusts illust, double height) { - if (illust.type == "manga") { - String url; - if (userSetting.mangaQuality == 0) - url = illust.metaPages[index].imageUrls!.medium; - else if (userSetting.mangaQuality == 1) - url = illust.metaPages[index].imageUrls!.large; - else - url = illust.metaPages[index].imageUrls!.original; - if (index == 0) - return LayoutBuilder( - builder: (context, constraints) => NullHero( - child: PixivImage( - url, - placeWidget: PixivImage( - illust.metaPages[index].imageUrls!.medium, - width: constraints.maxWidth, - fade: false, - ), - width: constraints.maxWidth, - fade: false, - ), - tag: widget.heroString, - ), - ); - return LayoutBuilder( - builder: (context, constraints) => PixivImage( - url, - fade: false, - width: constraints.maxWidth, - placeWidget: Container( - height: height, - child: Center( - child: Text('$index', - style: FluentTheme.of(context).typography.title), - ), - ), - ), - ); - } - return index == 0 - ? (userSetting.pictureQuality == 1 - ? NullHero( - child: PixivImage( - illust.metaPages[index].imageUrls!.large, - placeWidget: PixivImage( - illust.metaPages[index].imageUrls!.medium, - fade: false, - ), - fade: false, - ), - tag: widget.heroString, - ) - : NullHero( - child: PixivImage( - illust.metaPages[index].imageUrls!.medium, - fade: false, - ), - tag: widget.heroString, - )) - : PixivImage( - userSetting.pictureQuality == 0 - ? illust.metaPages[index].imageUrls!.medium - : illust.metaPages[index].imageUrls!.large, - fade: false, - placeWidget: Container( - height: 150, - child: Center( - child: Text('$index', - style: FluentTheme.of(context).typography.title), - ), - ), - ); - } - - Widget buildRow(BuildContext context, Tags f) { - return RowCard(f); - } - - Widget buildNameAvatar(BuildContext context, Illusts illust) { - if (userStore == null) - userStore = UserStore(illust.user.id, null, illust.user); - return Observer(builder: (_) { - Future.delayed(Duration(seconds: 2), () { - _loadAbout(); - }); - return ContextMenu( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Padding( - child: Container( - height: 70, - width: 70, - child: Stack( - children: [ - Center( - child: SizedBox( - height: 70, - width: 70, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: userStore!.isFollow - ? Colors.yellow - : FluentTheme.of(context).accentColor, - ), - ), - ), - ), - Center( - child: Hero( - tag: illust.user.profileImageUrls.medium + - this.hashCode.toString(), - child: PainterAvatar( - url: illust.user.profileImageUrls.medium, - id: illust.user.id, - onTap: () async { - await Leader.push( - context, - UsersPage( - id: illust.user.id, - userStore: userStore, - heroTag: this.hashCode.toString(), - ), - icon: Icon(FluentIcons.account_browser), - title: Text(I18n.of(context).painter_id + - '${illust.user.id}'), - ); - illustStore.illusts!.user.isFollowed = - userStore!.isFollow; - }, - ), - ), - ), - ], - ), - ), - padding: EdgeInsets.all(8.0)), - Expanded( - child: Padding( - padding: EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - illust.title, - style: - TextStyle(color: FluentTheme.of(context).accentColor), - ), - Container( - height: 4.0, - ), - Hero( - tag: illust.user.name + this.hashCode.toString(), - child: Text( - illust.user.name, - style: FluentTheme.of(context).typography.body, - ), - ), - Text( - illust.createDate.toShortTime(), - style: FluentTheme.of(context).typography.caption, - ), - ], - ), - ), - ), - ], - ), - items: [ - MenuFlyoutItem( - text: Text(I18n.of(context).follow), - onPressed: () async { - await userStore!.follow(); - }, - ), - ], - ); - }); - } - - Future showMutiChoiceDialog(Illusts illust, BuildContext context) async { - List indexs = []; - bool allOn = false; - for (int i = 0; i < illust.metaPages.length; i++) { - indexs.add(false); - } - await showDialog( - context: context, - builder: (context) { - return StatefulBuilder(builder: (context, setDialogState) { - return ContentDialog( - title: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - I18n.of(context).muti_choice_save, - style: FluentTheme.of(context) - .typography - .title - ?.copyWith(color: FluentTheme.of(context).accentColor), - ), - Text(illust.title), - ], - ), - content: SafeArea( - child: LayoutBuilder( - builder: (context, constraints) => SizedBox( - height: constraints.maxHeight > 500 - ? constraints.maxHeight * 0.5 - : constraints.maxHeight, - child: Column( - children: [ - Expanded( - child: GridView.builder( - itemBuilder: (context, index) { - final data = illust.metaPages[index]; - return Container( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: buildMultiChoiceItem( - data, - index, - indexs, - illust, - onChanged: (value) { - setDialogState(() { - indexs[index] = value ?? false; - }); - }, - ), - ), - ); - }, - itemCount: illust.metaPages.length, - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2), - ), - ), - Checkbox( - checked: allOn, - content: Text(I18n.of(context).all), - onChanged: (value) { - allOn = value ?? false; - for (var i = 0; i < indexs.length; i++) { - indexs[i] = allOn; - } - setDialogState(() {}); - }, - ) - ], - ), - ), - ), - ), - actions: [ - FilledButton( - child: Text(I18n.of(context).save), - onPressed: () { - saveStore.saveChoiceImage(illust, indexs); - }, - ), - Button( - child: Text(I18n.of(context).cancel), - onPressed: () {}, - ) - ], - ); - }); - }); - } - - Widget buildMultiChoiceItem( - MetaPages data, - int index, - List indexs, - Illusts illust, { - required void Function(bool?) onChanged, - }) { - return IconButton( - onPressed: () => onChanged(!indexs[index]), - icon: Stack( - children: [ - PixivImage( - data.imageUrls!.squareMedium, - placeWidget: Container( - child: Center( - child: Text(index.toString()), - ), - ), - ), - Align( - alignment: Alignment.bottomRight, - child: Checkbox( - checked: indexs[index], - onChanged: onChanged, - ), - ), - ], - ), - ); - } - - Future showBookMarkTag() async { - final result = await showDialog( - context: context, - builder: (context) => TagForIllustPage(id: widget.id), - ); - if (result is Map) { - LPrinter.d(result); - String restrict = result['restrict']; - List? tags = result['tags']; - illustStore.star(restrict: restrict, tags: tags, force: true); - } - } - - List buildDetail(BuildContext context, Illusts data) { - return [ - SliverToBoxAdapter( - child: buildNameAvatar(context, data), - ), - SliverToBoxAdapter( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SelectionContainer.disabled( - child: Text(I18n.of(context).illust_id)), - Container( - width: 10.0, - ), - colorText(data.id.toString(), context), - Container( - width: 20.0, - ), - SelectionContainer.disabled( - child: Text(I18n.of(context).pixel)), - Container( - width: 10.0, - ), - colorText("${data.width}x${data.height}", context) - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SelectionContainer.disabled( - child: Text(I18n.of(context).total_view)), - Container( - width: 10.0, - ), - colorText(data.totalView.toString(), context), - Container( - width: 20.0, - ), - SelectionContainer.disabled( - child: Text(I18n.of(context).total_bookmark)), - Container( - width: 10.0, - ), - colorText("${data.totalBookmarks}", context) - ], - ), - ], - ), - ), - ), - SliverToBoxAdapter( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.center, - spacing: 2, - runSpacing: 0, - children: [ - if (data.illustAIType == 2) - Text("${I18n.of(context).ai_generated}", - style: FluentTheme.of(context) - .typography - .caption! - .copyWith(color: FluentTheme.of(context).accentColor)), - for (var f in data.tags) buildRow(context, f) - ], - ), - ), - ), - SliverToBoxAdapter( - child: Card( - child: SelectionArea( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: SelectableHtml( - data: data.caption.isEmpty ? "~" : data.caption, - ), - ), - ), - ), - ), - SliverToBoxAdapter( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: SelectionContainer.disabled( - child: HyperlinkButton( - child: Text( - I18n.of(context).view_comment, - textAlign: TextAlign.center, - style: FluentTheme.of(context).typography.body!, - ), - onPressed: () { - Leader.push(context, CommentPage(id: data.id), - icon: Icon(FluentIcons.comment), - title: Text(I18n.of(context).view_comment)); - }, - ), - ), - ), - ), - SliverToBoxAdapter( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text(I18n.of(context).about_picture), - ), - ), - buildRecom() - ]; - } - - @override - bool get wantKeepAlive => false; -} - -class IllustItem extends StatelessWidget { - final int index; - final Illusts data; - final IllustItemsPage widget; - final Widget icon; - final Future Function() onMultiSavePressed; - - IllustItem( - this.index, - this.data, - this.widget, { - required this.icon, - required this.onMultiSavePressed, - }); - @override - Widget build(BuildContext context) { - return ContextMenu( - child: IconButton( - onPressed: () { - Leader.push( - context, - PhotoZoomPage( - index: index, - illusts: data, - ), - icon: Icon(FluentIcons.picture), - title: Text(I18n.of(context).illust_id + ': ${data.id}'), - ); - }, - icon: icon, - ), - items: [ - if (data.metaPages.isNotEmpty) - MenuFlyoutItem( - text: Text(I18n.of(context).muti_choice_save), - leading: Icon( - FluentIcons.save, - ), - onPressed: () async { - await onMultiSavePressed(); - }, - ), - MenuFlyoutItem( - leading: Icon(FluentIcons.save), - onPressed: () async { - await saveStore.saveImage(data, index: index); - }, - text: Text(I18n.of(context).save), - ), - if (ClipboardPlugin.supported) - MenuFlyoutItem( - text: Text(I18n.of(context).copy), - leading: Icon( - FluentIcons.copy, - ), - onPressed: () async { - final url = ClipboardPlugin.getImageUrl(data, index); - if (url == null) return; - - ClipboardPlugin.showToast( - context, - ClipboardPlugin.copyImageFromUrl(url), - ); - }, - ), - MenuFlyoutItem( - text: Text(I18n.of(context).copymessage), - leading: Icon( - FluentIcons.library, - ), - onPressed: () async { - await Clipboard.setData(ClipboardData( - text: - 'title:${data.title}\npainter:${data.user.name}\nillust id:${widget.id}')); - BotToast.showText(text: I18n.of(context).copied_to_clipboard); - }, - ), - MenuFlyoutItem( - text: Text(I18n.of(context).share), - leading: Icon( - FluentIcons.share, - ), - onPressed: () async { - await Share.share("https://www.pixiv.net/artworks/${widget.id}"); - }, - ), - MenuFlyoutItem( - leading: Icon( - FluentIcons.link, - ), - text: Text(I18n.of(context).link), - onPressed: () async { - await Clipboard.setData(ClipboardData( - text: "https://www.pixiv.net/artworks/${widget.id}")); - BotToast.showText(text: I18n.of(context).copied_to_clipboard); - }, - ), - MenuFlyoutItem( - text: Text(I18n.of(context).ban), - leading: Icon(FluentIcons.brightness), - onPressed: () async { - await muteStore.insertBanIllusts(BanIllustIdPersist( - illustId: widget.id.toString(), name: data.title)); - }, - ), - MenuFlyoutItem( - text: Text(I18n.of(context).report), - leading: Icon(FluentIcons.report_document), - onPressed: () async { - await showDialog( - context: context, - builder: (context) { - return ContentDialog( - title: Text(I18n.of(context).report), - content: Text(I18n.of(context).report_message), - actions: [ - HyperlinkButton( - child: Text(I18n.of(context).cancel), - onPressed: () { - Navigator.of(context).pop("CANCEL"); - }, - ), - HyperlinkButton( - child: Text(I18n.of(context).ok), - onPressed: () { - Navigator.of(context).pop("OK"); - }, - ), - ], - ); - }, - ); - }, - ) - ], - ); - } -} - -/// 相关图片 -class MoreItem extends StatelessWidget { - final int index; - final List list; - final IllustAboutStore _aboutStore; - - MoreItem( - this.index, - this.list, - this._aboutStore, - ); - @override - Widget build(BuildContext context) { - return ContextMenu( - child: IconButton( - onPressed: () { - Leader.push( - context, - PictureListPage( - iStores: list, - lightingStore: null, - store: list[index], - ), - icon: const Icon(FluentIcons.picture), - title: Text(I18n.of(context).illust_id + ': ${list[index].id}'), - ); - }, - icon: PixivImage( - _aboutStore.illusts[index].imageUrls.squareMedium, - enableMemoryCache: false, - ), - ), - items: [ - MenuFlyoutItem( - text: Text(I18n.of(context).save), - onPressed: () async { - await saveStore.saveImage(_aboutStore.illusts[index]); - }, - ) - ], - ); - } -} diff --git a/lib/fluent/page/picture/illust_lighting_page.dart b/lib/fluent/page/picture/illust_lighting_page.dart deleted file mode 100644 index 1676302b8..000000000 --- a/lib/fluent/page/picture/illust_lighting_page.dart +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/fluent/page/picture/illust_items_page.dart'; -import 'package:pixez/fluent/page/picture/illust_row_page.dart'; -import 'package:pixez/fluent/page/picture/illust_vertical_page.dart'; - -class IllustLightingPage extends IllustItemsPage { - const IllustLightingPage( - {Key? key, required super.id, super.heroString, super.store}) - : super(key: key); - - @override - State createState() => _IllustLightingPageState(); -} - -class _IllustLightingPageState extends State { - @override - Widget build(BuildContext context) { - switch (userSetting.padMode) { - case 0: - MediaQueryData mediaQuery = MediaQuery.of(context); - final ori = mediaQuery.size.width > mediaQuery.size.height; - if (ori) - return _buildRow(); - else - return _buildVertical(); - case 1: - return _buildVertical(); - case 2: - return _buildRow(); - default: - return Container(); - } - } - - _buildVertical() { - return IllustVerticalPage( - id: widget.id, - store: widget.store, - heroString: widget.heroString, - ); - } - - _buildRow() { - return IllustRowPage( - id: widget.id, - store: widget.store, - heroString: widget.heroString, - ); - } -} diff --git a/lib/fluent/page/picture/illust_row_page.dart b/lib/fluent/page/picture/illust_row_page.dart deleted file mode 100644 index 8a152377a..000000000 --- a/lib/fluent/page/picture/illust_row_page.dart +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:easy_refresh/easy_refresh.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/models/illust.dart'; -import 'package:pixez/fluent/page/picture/illust_items_page.dart'; - -class IllustRowPage extends IllustItemsPage { - const IllustRowPage( - {Key? key, required super.id, super.heroString, super.store}) - : super(key: key); - - @override - _IllustRowPageState createState() => _IllustRowPageState(); -} - -class _IllustRowPageState extends IllustItemsPageState { - @override - Widget buildContent(BuildContext context, Illusts? data) { - if (illustStore.errorMessage != null) return buildErrorContent(context); - if (data == null) - return Container( - child: Center( - child: ProgressRing(), - ), - ); - - return LayoutBuilder( - builder: (context, constraints) { - final expectWidth = constraints.maxWidth - 300; - final radio = (data.height.toDouble() / data.width); - final screenHeight = constraints.maxHeight; - final height = (radio * expectWidth); - final centerType = height <= screenHeight; - - return Container( - child: Row( - children: [ - Container( - width: expectWidth, - child: CustomScrollView( - slivers: [...buildPhotoList(data, centerType, height)]), - ), - Expanded( - child: Container( - color: FluentTheme.of(context).cardColor, - margin: EdgeInsets.only(right: 4.0), - child: EasyRefresh( - controller: refreshController, - onLoad: () { - aboutStore.next(); - }, - child: Observer( - builder: (_) => CustomScrollView( - controller: scrollController, - slivers: [ - ...buildDetail(context, data), - ], - ), - ), - ), - ), - ), - ], - ), - ); - }, - ); - } -} diff --git a/lib/fluent/page/picture/illust_vertical_page.dart b/lib/fluent/page/picture/illust_vertical_page.dart deleted file mode 100644 index c38ae9ab2..000000000 --- a/lib/fluent/page/picture/illust_vertical_page.dart +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:easy_refresh/easy_refresh.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/models/illust.dart'; -import 'package:pixez/fluent/page/picture/illust_items_page.dart'; - -class IllustVerticalPage extends IllustItemsPage { - const IllustVerticalPage( - {Key? key, required super.id, super.heroString, super.store}) - : super(key: key); - - @override - _IllustVerticalPageState createState() => _IllustVerticalPageState(); -} - -class _IllustVerticalPageState extends IllustItemsPageState { - @override - Widget buildContent(BuildContext context, Illusts? data) { - if (illustStore.errorMessage != null) return buildErrorContent(context); - if (data == null) - return Container( - child: Center( - child: ProgressRing(), - ), - ); - return LayoutBuilder( - builder: (context, constraints) { - final height = - ((data.height.toDouble() / data.width) * constraints.maxWidth); - return EasyRefresh( - controller: refreshController, - onLoad: () { - aboutStore.next(); - }, - child: Observer( - builder: (_) => CustomScrollView( - controller: scrollController, - slivers: [ - ...buildPhotoList(data, false, height), - ...buildDetail(context, data) - ], - ), - ), - ); - }, - ); - } -} diff --git a/lib/fluent/page/picture/picture_list_page.dart b/lib/fluent/page/picture/picture_list_page.dart deleted file mode 100644 index 8562d934b..000000000 --- a/lib/fluent/page/picture/picture_list_page.dart +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/lighting/lighting_store.dart'; -import 'package:pixez/fluent/page/picture/illust_lighting_page.dart'; -import 'package:pixez/page/picture/illust_store.dart'; - -class PictureListPage extends StatefulWidget { - final IllustStore store; - final List iStores; - final String? heroString; - final LightingStore? lightingStore; - - const PictureListPage( - {Key? key, - required this.lightingStore, - required this.store, - required this.iStores, - this.heroString}) - : super(key: key); - - @override - _PictureListPageState createState() => _PictureListPageState(); -} - -class _PictureListPageState extends State { - late PageController _pageController; - late int nowPosition; - late LightingStore? _lightingStore; - late List _iStores; - late IllustStore _store; - double screenWidth = 0; - - @override - void initState() { - _store = widget.store; - _iStores = widget.iStores; - _lightingStore = widget.lightingStore; - nowPosition = _iStores.indexOf(_store); - _pageController = PageController(initialPage: nowPosition); - super.initState(); - } - - @override - void dispose() { - _pageController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return LayoutBuilder( - builder: (context, constraints) { - screenWidth = constraints.maxWidth / 2; - return Stack( - children: [ - Observer(builder: (_) { - return PageView.builder( - controller: _pageController, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (BuildContext context, int index) { - if (index == _iStores.length && _lightingStore != null) { - return PictureListNextPage( - lightingStore: _lightingStore!, - ); - } - final f = _iStores[index]; - String? tag = nowPosition == index ? widget.heroString : null; - return IllustLightingPage( - id: f.id, - heroString: tag, - store: f, - ); - }, - itemCount: _iStores.length + 1, - ); - }), - Container( - margin: EdgeInsets.all(24), - child: GestureDetector( - onHorizontalDragEnd: (DragEndDetails detail) { - final pixelsPerSecond = detail.velocity.pixelsPerSecond; - if (pixelsPerSecond.dy.abs() > pixelsPerSecond.dx.abs()) - return; - if (pixelsPerSecond.dx.abs() > screenWidth) { - int result = nowPosition; - if (pixelsPerSecond.dx < 0) - result++; - else - result--; - _pageController.animateToPage(result, - duration: Duration(milliseconds: 200), - curve: Curves.easeInOut); - if (result >= _iStores.length) result = _iStores.length - 1; - if (result < 0) result = 0; - setState(() { - nowPosition = result; - }); - } - }, - ), - ) - ], - ); - }, - ); - } -} - -class PictureListNextPage extends StatefulWidget { - final LightingStore lightingStore; - const PictureListNextPage({super.key, required this.lightingStore}); - - @override - State createState() => _PictureListNextPageState(); -} - -class _PictureListNextPageState extends State { - late LightingStore _lightingStore; - bool? loadResult; - @override - void initState() { - _lightingStore = widget.lightingStore; - super.initState(); - _maybeFetch(true); - } - - _maybeFetch(bool firstIn) async { - if (_lightingStore.nextUrl == null) return; - try { - if (!firstIn) { - setState(() { - loadResult = null; - }); - } - final result = await _lightingStore.fetchNext(); - if (mounted) { - setState(() { - loadResult = result; - }); - } - } catch (e) {} - } - - @override - Widget build(BuildContext context) { - if (_lightingStore.nextUrl == null) { - return ScaffoldPage( - header: PageHeader(), - content: Center(child: Text("No More")), - ); - } - if (loadResult == false) { - return ScaffoldPage( - header: PageHeader(), - content: Container( - child: Center( - child: Column(children: [ - Text("Load Failed"), - HyperlinkButton( - onPressed: () { - _maybeFetch(false); - }, - child: Text("Retry")) - ]), - )), - ); - } - return ScaffoldPage( - content: Center( - child: ProgressRing(), - ), - ); - } -} diff --git a/lib/fluent/page/picture/row_card.dart b/lib/fluent/page/picture/row_card.dart deleted file mode 100644 index 73905bb1e..000000000 --- a/lib/fluent/page/picture/row_card.dart +++ /dev/null @@ -1,83 +0,0 @@ -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter/services.dart'; -import 'package:pixez/fluent/component/context_menu.dart'; -import 'package:pixez/fluent/component/focus_wrap.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/ban_tag.dart'; -import 'package:pixez/models/illust.dart'; -import 'package:pixez/fluent/page/search/result_page.dart'; - -class RowCard extends StatelessWidget { - final Tags f; - RowCard(this.f); - - @override - Widget build(BuildContext context) { - return ContextMenu( - child: FocusWrap( - child: GestureDetector( - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - text: "#${f.name}", - children: [ - TextSpan( - text: " ", - style: FluentTheme.of(context).typography.caption, - ), - TextSpan( - text: "${f.translatedName ?? "~"}", - style: FluentTheme.of(context).typography.caption) - ], - style: FluentTheme.of(context) - .typography - .caption! - .copyWith(color: FluentTheme.of(context).accentColor))), - onTap: () => _invoke(context), - ), - onInvoke: () => _invoke(context), - ), - items: [ - MenuFlyoutItem( - text: Text(I18n.of(context).ban), - onPressed: () async { - await muteStore.insertBanTag(BanTagPersist( - name: f.name, - translateName: f.translatedName ?? "", - )); - }, - ), - MenuFlyoutItem( - text: Text(I18n.of(context).bookmark), - onPressed: () async { - await bookTagStore.bookTag(f.name); - }, - ), - MenuFlyoutItem( - text: Text(I18n.of(context).copy), - onPressed: () async { - await Clipboard.setData(ClipboardData(text: f.name)); - displayInfoBar(context, - builder: (context, VoidCallback) => InfoBar( - title: Text(I18n.of(context).copied_to_clipboard), - )); - }, - ), - ], - ); - } - - _invoke(BuildContext context) { - Leader.push( - context, - ResultPage( - word: f.name, - translatedName: f.translatedName ?? "", - ), - icon: Icon(FluentIcons.show_results), - title: Text(I18n.of(context).tag + ' #${f.name}'), - ); - } -} diff --git a/lib/fluent/page/picture/save_effect_trailing.dart b/lib/fluent/page/picture/save_effect_trailing.dart deleted file mode 100644 index aab675bf2..000000000 --- a/lib/fluent/page/picture/save_effect_trailing.dart +++ /dev/null @@ -1,21 +0,0 @@ -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; - -class SaveEffectTrailing extends StatelessWidget { - const SaveEffectTrailing({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Observer(builder: (_) { - return ToggleSwitch( - content: Text(I18n.of(context).save_effect), - checked: userSetting.saveEffectEnable, - onChanged: (bool value) { - userSetting.saveEffectEnable = value; - }, - ); - }); - } -} diff --git a/lib/fluent/page/picture/tag_for_illust_page.dart b/lib/fluent/page/picture/tag_for_illust_page.dart deleted file mode 100644 index 8e0cb298d..000000000 --- a/lib/fluent/page/picture/tag_for_illust_page.dart +++ /dev/null @@ -1,155 +0,0 @@ -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/models/bookmark_detail.dart'; -import 'package:pixez/page/picture/tag_for_illust_store.dart'; - -class TagForIllustPage extends StatefulWidget { - final int id; - - const TagForIllustPage({Key? key, required this.id}) : super(key: key); - - @override - _TagForIllustPageState createState() => _TagForIllustPageState(); -} - -class _TagForIllustPageState extends State { - late TagForIllustStore _store; - final TextEditingController textEditingController = TextEditingController(); - - @override - void initState() { - _store = TagForIllustStore(widget.id)..fetch(); - super.initState(); - } - - @override - void dispose() { - textEditingController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return ContentDialog( - title: Row( - children: [ - ToggleSwitch( - onChanged: (bool value) { - _store.setRestrict(value); - }, - checked: _store.restrict == "public", - ), - Padding( - padding: EdgeInsets.only(left: 16.0), - child: Text((_store.restrict == "public" - ? I18n.of(context).public - : I18n.of(context).private)), - ), - Text(I18n.of(context).bookmark) - ], - ), - content: Observer(builder: (_) { - return Padding( - padding: EdgeInsets.symmetric(horizontal: 16.0), - child: Column( - children: [ - TextBox( - controller: textEditingController, - suffix: IconButton( - icon: Icon(FluentIcons.add), - onPressed: () { - final value = textEditingController.value.text.trim(); - if (value.isNotEmpty) - _store.insert(TagsR(isRegistered: true, name: value)); - textEditingController.clear(); - }, - ), - ), - _store.checkList.length == 0 - ? Padding( - padding: EdgeInsets.only(top: 16.0), - child: Center( - child: ProgressRing(), - ), - ) - : Expanded( - child: _store.errorMessage == null - ? ListView.builder( - padding: EdgeInsets.all(2.0).copyWith( - top: 8.0, - ), - itemCount: _store.checkList.length, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.only(bottom: 8.0), - child: Checkbox( - onChanged: (bool? value) { - _store.check(index, value!); - }, - content: Text(_store.tags[index].name), - checked: _store.checkList[index], - ), - ); - }, - ) - : Container( - child: Container( - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - height: 50, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text(':(', - style: FluentTheme.of(context) - .typography - .title), - ), - HyperlinkButton( - onPressed: () { - _store.fetch(); - }, - child: Text(I18n.of(context).retry)), - Padding( - padding: const EdgeInsets.all(16.0), - child: Text('${_store.errorMessage}'), - ) - ], - ), - ), - ), - ), - ], - ), - ); - }), - actions: [ - FilledButton( - child: Text(I18n.of(context).ok), - onPressed: confirm, - ), - Button( - child: Text(I18n.of(context).cancel), - onPressed: Navigator.of(context).pop, - ) - ], - ); - } - - confirm() async { - final tags = _store.tags; - List? tempTags = []; - for (int i = 0; i < tags.length; i++) { - if (tags[i].isRegistered) { - tempTags.add(tags[i].name); - } - } - if (tempTags.length == 0) tempTags = null; - Navigator.of(context).pop({"restrict": _store.restrict, "tags": tempTags}); - } -} diff --git a/lib/fluent/page/picture/ugoira_loader.dart b/lib/fluent/page/picture/ugoira_loader.dart deleted file mode 100644 index 56dd10b55..000000000 --- a/lib/fluent/page/picture/ugoira_loader.dart +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:bot_toast/bot_toast.dart'; -import 'package:fluent_ui/fluent_ui.dart' hide Image; -import 'package:flutter/services.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/fluent/component/context_menu.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/component/ugoira_painter.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/illust.dart'; -import 'package:pixez/page/picture/ugoira_store.dart'; - -class UgoiraLoader extends StatefulWidget { - final int id; - final Illusts illusts; - - const UgoiraLoader({Key? key, required this.id, required this.illusts}) - : super(key: key); - - @override - _UgoiraLoaderState createState() => _UgoiraLoaderState(); -} - -class _UgoiraLoaderState extends State { - late UgoiraStore _store; - - @override - void initState() { - _store = UgoiraStore(widget.id); - super.initState(); - } - - bool isEncoding = false; - static const platform = const MethodChannel('samples.flutter.dev/battery'); - - @override - Widget build(BuildContext context) { - return LayoutBuilder(builder: (context, constraints) { - final width = constraints.maxWidth; - return Observer(builder: (_) { - double height = widget.illusts.height.toDouble() / - widget.illusts.width.toDouble() * - width; - if (_store.status == UgoiraStatus.play) { - return ContextMenu( - child: UgoiraWidget( - delay: _store - .ugoiraMetadataResponse!.ugoiraMetadata.frames.first.delay, - ugoiraMetadataResponse: _store.ugoiraMetadataResponse!, - size: Size(width, height), - drawPools: _store.drawPool, - ), - items: [ - MenuFlyoutItem( - text: Text(I18n.of(context).encode_message), - onPressed: () {}, - ), - MenuFlyoutSeparator(), - MenuFlyoutItem( - text: Text(I18n.of(context).encode), - onPressed: () async { - try { - isEncoding = true; - await platform.invokeMethod('getBatteryLevel', { - "path": _store.drawPool.first.parent.path, - "delay": _store.ugoiraMetadataResponse!.ugoiraMetadata - .frames.first.delay, - "delay_array": _store - .ugoiraMetadataResponse!.ugoiraMetadata.frames - .map((e) => e.delay) - .toList(), - "name": userSetting.singleFolder - ? "${widget.illusts.user.name}_${widget.illusts.user.id}/${widget.id}" - : "${widget.id}", - }); - BotToast.showCustomText( - toastBuilder: (_) => Text("encoding...")); - } on PlatformException { - isEncoding = false; - } - }, - ), - MenuFlyoutItem( - text: Text(I18n.of(context).export), - onPressed: () async { - await _store.export(); - }, - ), - ], - ); - } - if (_store.status == UgoiraStatus.progress) - return Column( - children: [ - PixivImage(widget.illusts.imageUrls.medium), - ProgressBar(value: _store.count / _store.total) - ], - ); - return Container( - height: height + 72.0, - child: Stack( - children: [ - PixivImage( - widget.illusts.imageUrls.medium, - height: height, - width: width, - placeWidget: Container( - height: height, - ), - ), - Align( - alignment: Alignment.bottomCenter, - child: Container( - height: 72.0, - width: 72.0, - child: IconButton( - icon: Icon(FluentIcons.play), - onPressed: () { - _store.downloadAndUnzip(); - }), - ), - ) - ], - ), - ); - }); - }); - } -} diff --git a/lib/fluent/page/platform/platform_page.dart b/lib/fluent/page/platform/platform_page.dart deleted file mode 100644 index 346630888..000000000 --- a/lib/fluent/page/platform/platform_page.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'dart:io'; - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:package_info_plus/package_info_plus.dart'; -import 'package:pixez/document_plugin.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/fluent/page/hello/setting/save_format_page.dart'; - -part 'platform_page.windows.dart'; - -class PlatformPage extends StatefulWidget { - @override - State createState() { - if (Platform.isWindows) return _PlatformPageStateWindow(); - throw UnimplementedError(); - } -} diff --git a/lib/fluent/page/platform/platform_page.windows.dart b/lib/fluent/page/platform/platform_page.windows.dart deleted file mode 100644 index 6f21c3ef0..000000000 --- a/lib/fluent/page/platform/platform_page.windows.dart +++ /dev/null @@ -1,151 +0,0 @@ -part of 'platform_page.dart'; - -class _PlatformPageStateWindow extends State { - String path = ""; - - @override - void initState() { - super.initState(); - initVoid(); - } - - initVoid() async { - PackageInfo packageInfo = await PackageInfo.fromPlatform(); - setState(() { - version = packageInfo.version; - }); - String path = (await DocumentPlugin.getPath())!; - if (mounted) { - setState(() { - this.path = path; - }); - } - } - - String version = ""; - bool singleFolder = false; - - @override - Widget build(BuildContext context) { - return ContentDialog( - title: ListTile( - title: Text("Platform Setting"), - subtitle: Text( - "For Windows", - style: TextStyle(color: Colors.blue), - ), - ), - content: Observer(builder: (_) { - return SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - // TODO: 此处是指定文件保存位置相关的代码 目前不考虑实现 - // ListTile( - // leading: Icon(FluentIcons.folder), - // title: Text( - // '${I18n.of(context).save_path}(${userSetting.saveMode != 0 ? (userSetting.saveMode == 2 ? I18n.of(context).old_way : 'SAF') : "Media"})'), - // subtitle: Text(path), - // onPressed: () async { - // await showPathDialog(context); - // final path = await DocumentPlugin.getPath(); - // if (mounted) { - // setState(() { - // this.path = path!; - // }); - // } - // }, - // ), - // TODO: 没有实现 JSEvalPlugin 所以这里不能用 - ListTile( - leading: Icon(FluentIcons.format_painter), - title: Text(I18n.of(context).save_format), - subtitle: Text(userSetting.fileNameEval == 1 - ? "Eval" - : userSetting.format ?? ""), - onPressed: () async { - if (userSetting.fileNameEval == 1) { - // await showDialog( - // context: context, - // builder: (context) => SaveEvalPage(), - // useRootNavigator: false, - // ); - } else { - final result = await showDialog( - context: context, - builder: (context) => SaveFormatPage(), - useRootNavigator: false, - ); - if (result is String) { - userSetting.setFormat(result); - } - } - }, - // trailing: PixEzButton( - // onPressed: () async { - // await showDialog( - // context: context, - // builder: (context) => SaveEvalPage(), - // useRootNavigator: false, - // ); - // }, - // child: Container( - // margin: EdgeInsets.all(8), - // child: userSetting.fileNameEval == 1 - // ? Text( - // "Script", - // style: TextStyle( - // color: FluentTheme.of(context).accentColor), - // ) - // : Text("Script"), - // ), - // ), - ), - Observer( - builder: (context) { - return ListTile( - leading: Icon(FluentIcons.folder), - title: Text(I18n.of(context).separate_folder), - subtitle: Text(I18n.of(context).separate_folder_message), - trailing: ToggleSwitch( - checked: userSetting.singleFolder, - onChanged: (bool value) async { - if (value) { - displayInfoBar(context, - builder: (context, VoidCallback) => InfoBar( - title: Text('可能会造成保存等待时间过长'), - )); - } - await userSetting.setSingleFolder(value); - }, - ), - ); - }, - ), - Observer( - builder: (context) { - return ListTile( - leading: Icon(FluentIcons.folder_open), - title: Text("Sanity Single Folder"), - trailing: ToggleSwitch( - checked: userSetting.overSanityLevelFolder, - onChanged: (bool value) async { - await userSetting.setOverSanityLevelFolder(value); - }, - ), - ); - }, - ), - ], - ), - ); - }), - actions: [ - FilledButton( - child: Text(I18n.of(context).ok), - onPressed: Navigator.of(context).pop, - ), - ], - ); - } -} diff --git a/lib/fluent/page/preview/preview_page.dart b/lib/fluent/page/preview/preview_page.dart deleted file mode 100644 index d4ac65328..000000000 --- a/lib/fluent/page/preview/preview_page.dart +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:math'; - -import 'package:easy_refresh/easy_refresh.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/fluent/component/painter_avatar.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/fluent/page/login/login_page.dart'; -import 'package:pixez/utils.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/lighting/lighting_store.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/illust.dart'; -import 'package:pixez/network/api_client.dart'; -import 'package:waterfall_flow/waterfall_flow.dart'; - -class GoToLoginPage extends StatelessWidget { - final Illusts illust; - - const GoToLoginPage({Key? key, required this.illust}) : super(key: key); - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader(title: Text(illust.title)), - content: SafeArea( - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - PixivImage(illust.imageUrls.medium), - Row( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: PainterAvatar( - id: illust.user.id, - url: illust.user.profileImageUrls.medium, - onTap: () {}, - ), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text(illust.user.name), - ), - Text(illust.createDate), - ], - ) - ], - ) - ], - ), - ), - ), - ); - } -} - -class LoginInFirst extends StatelessWidget { - @override - Widget build(BuildContext context) { - return ScaffoldPage( - content: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Center( - child: Text( - '>_<', - style: TextStyle(fontSize: 26), - ), - ), - Center( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text(I18n.of(context).login_message), - )), - FilledButton( - child: Text(I18n.of(context).go_to_login), - onPressed: () { - Leader.push( - context, - LoginPage(), - icon: Icon(FluentIcons.people), - title: Text(I18n.of(context).login), - ); - }, - ) - ], - ), - ); - } -} - -class PreviewPage extends StatefulWidget { - @override - _PreviewPageState createState() => _PreviewPageState(); -} - -class _PreviewPageState extends State { - final LightingStore _lightingStore = LightingStore( - ApiSource(futureGet: () => apiClient.walkthroughIllusts()), - ); - final ScrollController _scrollController = ScrollController(); - - @override - void initState() { - _lightingStore.easyRefreshController = EasyRefreshController( - controlFinishLoad: true, controlFinishRefresh: true); - _lightingStore.fetch(url: "walkthrough"); - initializeScrollController(_scrollController, _lightingStore.fetchNext); - - super.initState(); - } - - @override - void dispose() { - _lightingStore.dispose(); - _scrollController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - final orientation = MediaQuery.of(context).orientation; - var count = 0; - if (userSetting.crossAdapt) { - count = _buildSliderValue(context, orientation); - } else { - count = (orientation == Orientation.portrait) - ? userSetting.crossCount - : userSetting.hCrossCount; - } - - return Observer(builder: (_) { - return SafeArea( - child: EasyRefresh( - refreshOnStart: true, - controller: _lightingStore.easyRefreshController, - onRefresh: () => _lightingStore.fetch(url: "walkthrough"), - onLoad: () => _lightingStore.fetchNext(), - child: WaterfallFlow.builder( - controller: _scrollController, - shrinkWrap: true, - gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount( - crossAxisCount: count, - ), - itemBuilder: (BuildContext context, int index) { - return IconButton( - onPressed: () { - Leader.push( - context, - GoToLoginPage( - illust: _lightingStore.iStores[index].illusts!, - ), - icon: Icon(FluentIcons.picture), - title: Text( - '${I18n.of(context).illust}: ${_lightingStore.iStores[index].illusts}'), - ); - }, - icon: Card( - child: Container( - child: PixivImage(_lightingStore - .iStores[index].illusts!.imageUrls.squareMedium), - ), - ), - ); - }, - itemCount: _lightingStore.iStores.length, - ), - ), - ); - }); - } - - int _buildSliderValue(BuildContext context, Orientation orientation) { - final currentValue = (orientation == Orientation.portrait - ? userSetting.crossAdapterWidth - : userSetting.hCrossAdapterWidth) - .toDouble(); - var nowAdaptWidth = max(currentValue, 50.0); - nowAdaptWidth = min(nowAdaptWidth, 2160); - return max((MediaQuery.of(context).size.width / nowAdaptWidth), 1.0) - .toInt(); - } -} diff --git a/lib/fluent/page/report/report_items_page.dart b/lib/fluent/page/report/report_items_page.dart deleted file mode 100644 index 96aff300f..000000000 --- a/lib/fluent/page/report/report_items_page.dart +++ /dev/null @@ -1,85 +0,0 @@ -import 'package:bot_toast/bot_toast.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; - -class ReportItemsPage extends StatefulWidget { - final FutureFunc onSubmit; - const ReportItemsPage({super.key, required this.onSubmit}); - - @override - State createState() => _ReportItemsPageState(); -} - -class Reporter { - static Future show(BuildContext context, FutureFunc onSubmit) async { - await Leader.push( - context, - ReportItemsPage(onSubmit: onSubmit), - icon: Icon(FluentIcons.report_document), - title: Text(I18n.of(context).report), - ); - } -} - -class _ReportItemsPageState extends State { - final items = [ - "Sexual Content and Profanity", - "Hate Speech", - "Terrorist Content", - "Dangerous Organizations and Movements", - "Sensitive Events", - "Bullying and Harassment", - "Dangerous Products", - "Marijuana", - "Tobacco and Alcohol", - ]; //政策合规问题,应该不需要翻译,或者说翻译有风险 - - var _selectItem = 0; - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader(title: Text(I18n.of(context).report)), - content: Stack( - children: [ - ListView.builder( - itemBuilder: (context, index) { - final title = items[index]; - return Container( - color: index == _selectItem - ? FluentTheme.of(context).accentColor.withOpacity(0.5) - : Colors.transparent, - child: ListTile( - title: Text(title), - onPressed: () { - setState(() { - _selectItem = index; - }); - }, - ), - ); - }, - itemCount: items.length), - Align( - alignment: Alignment.bottomCenter, - child: Padding( - padding: - const EdgeInsets.symmetric(vertical: 32.0, horizontal: 16), - child: FilledButton( - onPressed: () async { - BotToast.showLoading(); - await widget.onSubmit(); - BotToast.closeAllLoading(); - Navigator.of(context).pop(); - BotToast.showText(text: "Thanks for your feedback"); - }, - child: Text("Submit"), - ), - ), - ) - ], - ), - ); - } -} diff --git a/lib/fluent/page/river/river_page.dart b/lib/fluent/page/river/river_page.dart deleted file mode 100644 index 81429dc62..000000000 --- a/lib/fluent/page/river/river_page.dart +++ /dev/null @@ -1,120 +0,0 @@ -import 'dart:math'; - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; -import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/illust.dart'; -import 'package:pixez/page/river/river_provider.dart'; -import 'package:waterfall_flow/waterfall_flow.dart'; - -final illustsProvider = - StateNotifierProvider((ref) { - return IllustListNotifier(ref); -}); - -class RiverPage extends HookConsumerWidget { - @override - Widget build(Object context, WidgetRef ref) { - final provider = ref.watch(illustsProvider); - final illusts = provider.illusts; - final scrollController = useScrollController(); - useEffect(() { - scrollController.addListener(() { - if (scrollController.hasClients) { - if (scrollController.position.atEdge) { - if (scrollController.position.pixels != 0) { - ref.read(illustsProvider.notifier).next(); - } - } - } - }); - ref.read(illustsProvider.notifier).fetch(offset: 30); - return null; - }, [scrollController]); - // ref.read(illustsProvider.notifier).fetch(); - - return Stack( - children: [ - CustomScrollView( - controller: scrollController, - slivers: [ - SliverToBoxAdapter( - child: _buildTopIndicator(), - ), - SliverWaterfallFlow( - gridDelegate: _buildGridDelegate(ref.context), - delegate: _buildSliverChildBuilderDelegate(ref.context, illusts), - ) - ], - ), - Container( - child: Align( - alignment: Alignment.bottomRight, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Card( - child: Container( - height: 60, - width: 60, - color: FluentTheme.of(ref.context).cardColor, - child: Center(child: Text("0")), - ), - ), - ), - ), - ) - ], - ); - } - - Widget _buildTopIndicator() { - return Container( - height: 60.0, - child: Center( - child: Text( - "Top", - style: TextStyle(color: Colors.grey), - ), - ), - ); - } - - SliverChildBuilderDelegate _buildSliverChildBuilderDelegate( - BuildContext context, List illusts) { - return SliverChildBuilderDelegate((BuildContext context, int index) { - final illust = illusts[index]; - return Card( - child: PixivImage(illust.imageUrls.medium), - ); - }, childCount: illusts.length); - } - - SliverWaterfallFlowDelegate _buildGridDelegate(context) { - var count = 2; - if (userSetting.crossAdapt) { - count = _buildSliderValue(context); - } else { - count = (MediaQuery.of(context).orientation == Orientation.portrait) - ? userSetting.crossCount - : userSetting.hCrossCount; - } - return SliverWaterfallFlowDelegateWithFixedCrossAxisCount( - crossAxisCount: count, - ); - } - - int _buildSliderValue(context) { - final currentValue = - (MediaQuery.of(context).orientation == Orientation.portrait - ? userSetting.crossAdapterWidth - : userSetting.hCrossAdapterWidth) - .toDouble(); - var nowAdaptWidth = max(currentValue, 50.0); - nowAdaptWidth = min(nowAdaptWidth, 2160.0); - final screenWidth = MediaQuery.of(context).size.width; - final result = max(screenWidth / nowAdaptWidth, 1.0).toInt(); - return result; - } -} diff --git a/lib/fluent/page/river/river_provider.dart b/lib/fluent/page/river/river_provider.dart deleted file mode 100644 index 569167464..000000000 --- a/lib/fluent/page/river/river_provider.dart +++ /dev/null @@ -1,57 +0,0 @@ -import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:pixez/models/illust.dart'; -import 'package:pixez/models/recommend.dart'; -import 'package:pixez/network/api_client.dart'; - -class IllustListState { - final List illusts; - final int? preCursor; - final int? nextCursor; - - IllustListState(this.illusts, this.preCursor, this.nextCursor); -} - -class IllustListNotifier extends StateNotifier { - final Ref ref; - IllustListNotifier(this.ref) : super(IllustListState([], null, null)); - - fetch({int offset = 0}) async { - try { - final response = await apiClient.getUserIllustsOffset( - 420509, "illust", offset < 30 ? null : offset); - Recommend recommend = Recommend.fromJson(response.data); - final preCursor = (offset - recommend.illusts.length) < 30 - ? null - : (offset - recommend.illusts.length); - final nextCursor = recommend.illusts.length < 30 - ? null - : (offset += recommend.illusts.length); - state = IllustListState(recommend.illusts, preCursor, nextCursor); - } catch (e) {} - } - - pre() async { - try { - if (state.preCursor == null) return; - final response = await apiClient.getUserIllustsOffset( - 420509, "illust", state.preCursor); - Recommend recommend = Recommend.fromJson(response.data); - final illusts = [...recommend.illusts, ...state.illusts]; - final preCursorOffset = state.preCursor! - recommend.illusts.length; - final preOffset = (preCursorOffset < 30) ? null : preCursorOffset; - state = IllustListState(illusts, preOffset, state.nextCursor); - } catch (e) {} - } - - next() async { - try { - if (state.nextCursor == null) return; - final response = await apiClient.getUserIllustsOffset( - 420509, "illust", state.nextCursor); - Recommend recommend = Recommend.fromJson(response.data); - final illusts = [...state.illusts, ...recommend.illusts]; - final nextCursor = recommend.illusts.length < 30 ? null : illusts.length; - state = IllustListState(illusts, state.nextCursor, nextCursor); - } catch (e) {} - } -} diff --git a/lib/fluent/page/search/result/painter/search_result_painter_page.dart b/lib/fluent/page/search/result/painter/search_result_painter_page.dart deleted file mode 100644 index a412b1cae..000000000 --- a/lib/fluent/page/search/result/painter/search_result_painter_page.dart +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/network/api_client.dart'; -import 'package:pixez/fluent/page/painter/painter_list.dart'; - -class SearchResultPainterPage extends StatefulWidget { - final String word; - - SearchResultPainterPage({Key? key, required this.word}) : super(key: key); - - @override - _SearchResultPainterPageState createState() => - _SearchResultPainterPageState(); -} - -class _SearchResultPainterPageState extends State { - @override - Widget build(BuildContext context) { - return PainterList( - futureGet: () => apiClient.getSearchUser(widget.word), - ); - } -} diff --git a/lib/fluent/page/search/result_illust_list.dart b/lib/fluent/page/search/result_illust_list.dart deleted file mode 100644 index 15ea8cbf9..000000000 --- a/lib/fluent/page/search/result_illust_list.dart +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:async'; - -import 'package:bot_toast/bot_toast.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/fluent/lighting/fluent_lighting_page.dart'; -import 'package:pixez/lighting/lighting_store.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/network/api_client.dart'; -import 'package:pixez/page/search/result_illust_store.dart'; - -class ResultIllustList extends StatefulWidget { - final String word; - - const ResultIllustList({Key? key, required this.word}) : super(key: key); - - @override - _ResultIllustListState createState() => _ResultIllustListState(); -} - -class _ResultIllustListState extends State { - late ResultIllustStore resultIllustStore; - late ApiForceSource futureGet; - late ScrollController _scrollController; - late StreamSubscription listen; - - @override - void initState() { - _scrollController = ScrollController(); - futureGet = ApiForceSource( - futureGet: (e) => apiClient.getSearchIllust(widget.word)); - super.initState(); - listen = topStore.topStream.listen((event) { - if (event == "401") { - _scrollController.position.jumpTo(0); - } - }); - } - - @override - void dispose() { - listen.cancel(); - super.dispose(); - } - - List starNum = [ - 0, - 100, - 250, - 500, - 1000, - 5000, - 7500, - 10000, - 20000, - 30000, - 50000, - ]; - - final sort = [ - "date_desc", - "date_asc", - "popular_desc", - "popular_male_desc", - "popular_female_desc" - ]; - static List search_target = [ - "partial_match_for_tags", - "exact_match_for_tags", - "title_and_caption" - ]; - String searchTarget = search_target[0]; - String selectSort = "date_desc"; - int selectStarNum = 0; - // double starValue = 0.0; - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: Align( - alignment: Alignment.centerRight, - child: Row( - children: [ - IconButton( - icon: Icon(FluentIcons.date_time), - onPressed: () { - _buildShowDateRange(context); - }), - _buildStar(), - IconButton( - icon: Icon(FluentIcons.filter), - onPressed: () { - _buildShowBottomSheet(context); - // _showMaterialBottom(); - }), - ], - ), - ), - content: LightingList( - source: futureGet, - scrollController: _scrollController, - ), - ); - } - - DateTimeRange? _dateTimeRange; - - Future _buildShowDateRange(BuildContext context) async { - throw Exception('Not Impliment'); - // DateTimeRange? dateTimeRange = await showDateRangePicker( - // context: context, - // initialDateRange: _dateTimeRange, - // firstDate: DateTime.fromMillisecondsSinceEpoch( - // DateTime.now().millisecondsSinceEpoch - - // (24 * 60 * 60 * 365 * 1000 * 8)), - // lastDate: DateTime.now()); - // if (dateTimeRange != null) { - // _dateTimeRange = dateTimeRange; - // setState(() { - // _changeQueryParams(); - // }); - // } - } - - _changeQueryParams() { - if (_starValue == 0) - futureGet = ApiForceSource( - futureGet: (bool e) => apiClient.getSearchIllust(widget.word, - search_target: searchTarget, - sort: selectSort, - start_date: _dateTimeRange?.start, - end_date: _dateTimeRange?.end, - bookmark_num: null)); - else - futureGet = ApiForceSource( - futureGet: (bool e) => apiClient.getSearchIllust( - '${widget.word} ${_starValue}users入り', - search_target: searchTarget, - sort: selectSort, - start_date: _dateTimeRange?.start, - end_date: _dateTimeRange?.end, - bookmark_num: null)); - } - - void _buildShowBottomSheet(BuildContext context) { - showDialog( - context: context, - builder: (context) => ContentDialog( - title: Text(I18n.of(context).filter), - content: StatefulBuilder(builder: (_, setS) { - return SafeArea( - child: LayoutBuilder( - builder: (context, constraints) => Container( - width: constraints.maxWidth, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: SizedBox( - width: double.infinity, - child: ComboBox( - value: search_target.indexOf(searchTarget), - items: [ - ComboBoxItem( - child: - Text(I18n.of(context).partial_match_for_tag), - value: 0, - ), - ComboBoxItem( - child: Text(I18n.of(context).exact_match_for_tag), - value: 1, - ), - ComboBoxItem( - child: Text(I18n.of(context).title_and_caption), - value: 2, - ), - ], - onChanged: (int? index) { - setS(() { - searchTarget = search_target[index!]; - }); - }, - ), - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: SizedBox( - width: double.infinity, - child: ComboBox( - value: sort.indexOf(selectSort), - items: [ - ComboBoxItem( - child: Text(I18n.of(context).date_desc), - value: 0, - ), - ComboBoxItem( - child: Text(I18n.of(context).date_asc), - value: 1, - ), - ComboBoxItem( - child: Text(I18n.of(context).popular_desc), - value: 2, - ), - ComboBoxItem( - child: Text(I18n.of(context).popular_male_desc), - value: 3, - ), - ComboBoxItem( - child: Text(I18n.of(context).popular_female_desc), - value: 4, - ), - ], - onChanged: (int? index) { - if (accountStore.now != null && index == 2) { - if (accountStore.now!.isPremium == 0) { - BotToast.showText(text: 'not premium'); - setState(() { - futureGet = ApiForceSource( - futureGet: (bool e) => apiClient - .getPopularPreview(widget.word)); - }); - Navigator.of(context).pop(); - return; - } - } - setS(() { - selectSort = sort[index!]; - }); - }, - ), - ), - ), - Container( - height: 16, - ) - ], - ), - ), - ), - ); - }), - actions: [ - FilledButton( - onPressed: () { - setState(() { - _changeQueryParams(); - }); - Navigator.of(context).pop(); - }, - child: Text(I18n.of(context).apply), - ), - Button( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text(I18n.of(context).cancel), - ), - ], - ), - ); - } - - int _starValue = 0; - - Widget _buildStar() { - return ComboBox( - value: _starValue, - icon: Icon(FluentIcons.sort), - items: starNum.map((int value) { - if (value > 0) { - return ComboBoxItem( - value: value, - child: Text("${value} users入り"), - onTap: () { - setState(() { - _starValue = value; - _changeQueryParams(); - }); - }, - ); - } else { - return ComboBoxItem( - value: value, - child: Text("Default"), - onTap: () { - setState(() { - _starValue = value; - _changeQueryParams(); - }); - }, - ); - } - }).toList()); - } -} diff --git a/lib/fluent/page/search/result_page.dart b/lib/fluent/page/search/result_page.dart deleted file mode 100644 index 42c947581..000000000 --- a/lib/fluent/page/search/result_page.dart +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/tags.dart'; -import 'package:pixez/fluent/page/search/result/painter/search_result_painter_page.dart'; -import 'package:pixez/fluent/page/search/result_illust_list.dart'; - -class ResultPage extends StatefulWidget { - final String word; - final String translatedName; - - const ResultPage({Key? key, required this.word, this.translatedName = ''}) - : super(key: key); - - @override - _ResultPageState createState() => _ResultPageState(); -} - -class _ResultPageState extends State { - @override - void initState() { - super.initState(); - tagHistoryStore.insert( - TagsPersist(name: widget.word, translatedName: widget.translatedName)); - } - - int index = 0; - - @override - Widget build(BuildContext context) { - return NavigationView( - pane: NavigationPane( - displayMode: PaneDisplayMode.top, - selected: index, - onChanged: (value) => setState(() => index = value), - items: [ - PaneItem( - icon: Icon(FluentIcons.picture), - body: ResultIllustList(word: widget.word), - title: Text(I18n.of(context).illust), - ), - PaneItem( - icon: Icon(FluentIcons.format_painter), - body: SearchResultPainterPage(word: widget.word), - title: Text(I18n.of(context).painter), - ), - ], - ), - ); - } -} diff --git a/lib/fluent/page/search/suggest/search_suggestion_page.dart b/lib/fluent/page/search/suggest/search_suggestion_page.dart deleted file mode 100644 index 151cb7015..000000000 --- a/lib/fluent/page/search/suggest/search_suggestion_page.dart +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:bot_toast/bot_toast.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/page/picture/illust_lighting_page.dart'; -import 'package:pixez/page/saucenao/sauce_store.dart'; -import 'package:pixez/page/search/result_page.dart'; -import 'package:pixez/page/search/suggest/suggestion_store.dart'; -import 'package:pixez/page/soup/soup_page.dart'; -import 'package:pixez/page/user/users_page.dart'; - -class SearchSuggestionPage extends StatefulWidget { - final String? preword; - - const SearchSuggestionPage({Key? key, this.preword}) : super(key: key); - - @override - _SearchSuggestionPageState createState() => _SearchSuggestionPageState(); -} - -class _SearchSuggestionPageState extends State { - late TextEditingController _filter; - late SuggestionStore _suggestionStore; - late SauceStore _sauceStore; - FocusNode focusNode = FocusNode(); - final tagGroup = []; - bool idV = false; - - @override - void initState() { - _suggestionStore = SuggestionStore(); - _sauceStore = SauceStore(); - _sauceStore.observableStream.listen((event) { - if (event != null && _sauceStore.results.isNotEmpty) { - Leader.push( - context, - PageView( - children: _sauceStore.results - .map((element) => IllustLightingPage(id: element)) - .toList(), - ), - icon: const Icon(FluentIcons.picture_library), - title: Text(I18n.of(context).search), - ); - } else { - BotToast.showText(text: "0 result"); - } - }); - var query = widget.preword ?? ''; - _filter = TextEditingController(text: query); - var tags = query - .split(" ") - .map((e) => e.trim()) - .takeWhile((value) => value.isNotEmpty); - if (tags.length > 1) tagGroup.addAll(tags); - super.initState(); - } - - @override - void dispose() { - _filter.dispose(); - _sauceStore.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Observer(builder: (context) { - return ScaffoldPage( - header: _buildAppBar(context), - content: Container( - child: Column( - children: [ - Divider(), - Expanded( - child: CustomScrollView( - slivers: [ - SliverToBoxAdapter( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Wrap( - spacing: 10, - children: [ - for (String i in tagGroup) - Button( - child: Text(i), - onPressed: () { - final start = _filter.text.indexOf(i); - if (start != -1) - _filter.selection = - TextSelection.fromPosition( - TextPosition( - offset: start + i.length, - ), - ); - }, - ) - ], - ), - ), - ), - SliverVisibility( - sliver: SliverList( - delegate: SliverChildBuilderDelegate((context, index) { - if (index == 0) - return ListTile( - title: Text(_filter.text), - subtitle: Text(I18n.of(context).illust_id), - onPressed: () { - Leader.push( - context, - IllustLightingPage( - id: int.tryParse(_filter.text)!, - ), - icon: const Icon(FluentIcons.picture), - title: Text(_filter.text), - ); - }, - ); - if (index == 1) - return ListTile( - title: Text(_filter.text), - subtitle: Text(I18n.of(context).painter_id), - onPressed: () { - Leader.push( - context, - UsersPage( - id: int.tryParse(_filter.text)!, - ), - icon: const Icon(FluentIcons.picture), - title: Text(_filter.text), - ); - }, - ); - if (index == 2 && _filter.text.length < 5) - return ListTile( - title: Text(_filter.text), - subtitle: Text("Pixivision Id"), - onPressed: () { - Leader.push( - context, - SoupPage( - url: - "https://www.pixivision.net/zh/a/${_filter.text.trim()}", - spotlight: null, - ), - icon: const Icon(FluentIcons.picture), - title: Text(_filter.text), - ); - }, - ); - return ListTile(); - }, childCount: 3), - ), - visible: idV, - ), - if (_suggestionStore.autoWords != null && - _suggestionStore.autoWords!.tags.isNotEmpty) - SliverList( - delegate: SliverChildBuilderDelegate((context, index) { - final tags = _suggestionStore.autoWords!.tags; - return ListTile( - onPressed: () { - if (tagGroup.length > 1) { - tagGroup.last = tags[index].name; - var text = tagGroup.join(" "); - _filter.text = text; - _filter.selection = TextSelection.fromPosition( - TextPosition(offset: text.length)); - setState(() {}); - } else { - FocusScope.of(context).unfocus(); - Leader.push( - context, - ResultPage( - word: tags[index].name, - translatedName: - tags[index].translated_name ?? "", - ), - icon: Icon(FluentIcons.search), - title: Text(I18n.of(context).search + - " " + - tags[index].name), - ); - } - }, - title: Text(tags[index].name), - subtitle: Text(tags[index].translated_name ?? ""), - ); - }, childCount: _suggestionStore.autoWords!.tags.length), - ), - ], - ), - ), - ], - ), - ), - ); - }); - } - - PageHeader _buildAppBar(context) { - return PageHeader( - title: _textField(context, TextInputType.text, focusNode), - commandBar: CommandBar( - primaryItems: [ - CommandBarButton( - onPressed: () { - _sauceStore.findImage(); - }, - icon: Icon(FluentIcons.add_field), - ), - CommandBarButton( - icon: Icon(FluentIcons.chrome_close, - color: FluentTheme.of(context).typography.body!.color), - onPressed: () { - _filter.clear(); - }, - ) - ], - ), - ); - } - - TextBox _textField( - BuildContext context, TextInputType inputType, FocusNode node) { - return TextBox( - controller: _filter, - focusNode: node, - keyboardType: inputType, - autofocus: true, - cursorColor: FluentTheme.of(context).iconTheme.color, - style: FluentTheme.of(context) - .typography - .subtitle! - .copyWith(color: FluentTheme.of(context).iconTheme.color), - onTap: () { - FocusScope.of(context).requestFocus(node); - }, - onChanged: (query) { - tagGroup.clear(); - var tags = query - .split(" ") - .map((e) => e.trim()) - .takeWhile((value) => value.isNotEmpty); - if (tags.length > 1) tagGroup.addAll(tags); - setState(() {}); - bool isNum = int.tryParse(query) != null; - setState(() { - idV = isNum; - }); - if (query.startsWith('https://')) { - Leader.pushWithUri(context, Uri.parse(query)); - _filter.clear(); - return; - } - var word = query.trim(); - if (word.isEmpty) return; - if (isNum && word.length > 5) return; //超过五个数字应该就不需要给建议了吧 - word = tags.last; - if (word.isEmpty) return; - _suggestionStore.fetch(word); - }, - onSubmitted: (s) { - var word = s.trim(); - if (word.isEmpty) return; - Leader.push( - context, - ResultPage( - word: word, - ), - icon: const Icon(FluentIcons.search), - title: Text(I18n.of(context).search + " " + word), - ); - }, - placeholder: I18n.of(context).search_word_or_paste_link, - ); - } -} diff --git a/lib/fluent/page/shield/shield_page.dart b/lib/fluent/page/shield/shield_page.dart deleted file mode 100644 index 37acc98a6..000000000 --- a/lib/fluent/page/shield/shield_page.dart +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/ban_illust_id.dart'; -import 'package:pixez/models/ban_tag.dart'; -import 'package:pixez/models/ban_user_id.dart'; - -class ShieldPage extends StatefulWidget { - @override - _ShieldPageState createState() => _ShieldPageState(); -} - -class _ShieldPageState extends State { - @override - void initState() { - muteStore.fetchBanUserIds(); - muteStore.fetchBanIllusts(); - muteStore.fetchBanUserIds(); - muteStore.fetchBanComments(); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Observer( - builder: (_) { - return ContentDialog( - title: Text(I18n.of(context).shielding_settings), - content: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text(I18n.of(context).tag), - Container( - child: Wrap( - spacing: 2.0, - runSpacing: 2.0, - direction: Axis.horizontal, - children: muteStore.banTags - .map( - (f) => Button( - onPressed: () => deleteTag(context, f), - child: Text(f.name), - ), - ) - .toList(), - ), - ), - Divider(), - Text(I18n.of(context).painter), - Container( - child: Wrap( - spacing: 2.0, - runSpacing: 2.0, - direction: Axis.horizontal, - children: muteStore.banUserIds - .map( - (f) => Button( - onPressed: () => _deleteUserIdTag(context, f), - child: Text(f.name ?? ""), - ), - ) - .toList(), - ), - ), - Divider(), - Text(I18n.of(context).illust), - Container( - child: Wrap( - spacing: 2.0, - runSpacing: 2.0, - direction: Axis.horizontal, - children: muteStore.banillusts - .map( - (f) => Button( - onPressed: () => _deleteIllust(context, f), - child: Text(f.name), - ), - ) - .toList(), - ), - ), - ], - ), - ), - actions: [ - FilledButton( - child: Text(I18n.of(context).ok), - onPressed: Navigator.of(context).pop, - ), - ], - ); - }, - ); - } - - Future deleteTag(BuildContext context, BanTagPersist f) async { - final result = await showDialog( - context: context, - useRootNavigator: false, - builder: (context) { - return ContentDialog( - title: Text(I18n.of(context).delete), - content: Text('Delete this tag?'), - actions: [ - Button( - child: Text(I18n.of(context).cancel), - onPressed: () { - Navigator.pop(context); - }, - ), - FilledButton( - onPressed: () { - Navigator.pop(context, "OK"); - }, - child: Text(I18n.of(context).ok), - ), - ], - ); - }, - ); - switch (result) { - case "OK": - { - muteStore.deleteBanTag(f.id!); - } - break; - } - } - - Future _deleteIllust(BuildContext context, BanIllustIdPersist f) async { - final result = await showDialog( - context: context, - useRootNavigator: false, - builder: (context) { - return ContentDialog( - title: Text(I18n.of(context).delete), - content: Text('Delete this tag?'), - actions: [ - Button( - child: Text(I18n.of(context).cancel), - onPressed: () { - Navigator.pop(context); - }, - ), - FilledButton( - onPressed: () { - Navigator.pop(context, "OK"); - }, - child: Text(I18n.of(context).ok), - ), - ], - ); - }, - ); - switch (result) { - case "OK": - { - muteStore.deleteBanIllusts(f.id!); - } - break; - } - } - - Future _deleteUserIdTag(BuildContext context, BanUserIdPersist f) async { - final result = await showDialog( - context: context, - useRootNavigator: false, - builder: (context) { - return ContentDialog( - title: Text(I18n.of(context).delete), - content: Text('Delete this tag?'), - actions: [ - Button( - child: Text(I18n.of(context).cancel), - onPressed: () { - Navigator.pop(context); - }, - ), - FilledButton( - onPressed: () { - Navigator.pop(context, "OK"); - }, - child: Text(I18n.of(context).ok), - ), - ], - ); - }, - ); - switch (result) { - case "OK": - { - muteStore.deleteBanUserId(f.id!); - } - break; - } - } -} diff --git a/lib/fluent/page/soup/soup_page.dart b/lib/fluent/page/soup/soup_page.dart deleted file mode 100644 index 8aac78e53..000000000 --- a/lib/fluent/page/soup/soup_page.dart +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/fluent/component/painter_avatar.dart'; -import 'package:pixez/fluent/component/pixez_button.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/amwork.dart'; -import 'package:pixez/models/spotlight_response.dart'; -import 'package:pixez/fluent/page/picture/illust_lighting_page.dart'; -import 'package:pixez/page/picture/illust_store.dart'; -import 'package:pixez/page/soup/soup_store.dart'; -import 'package:url_launcher/url_launcher.dart'; -import 'package:waterfall_flow/waterfall_flow.dart'; - -class SoupPage extends StatefulWidget { - final String url; - final SpotlightArticle? spotlight; - final String? heroTag; - - SoupPage({Key? key, required this.url, required this.spotlight, this.heroTag}) - : super(key: key); - - @override - _SoupPageState createState() => _SoupPageState(); -} - -class _SoupPageState extends State { - final SoupStore _soupStore = SoupStore(); - - @override - void initState() { - _soupStore.fetch(widget.url); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader( - title: Text(widget.spotlight!.pureTitle), - commandBar: widget.spotlight != null - ? CommandBar( - mainAxisAlignment: MainAxisAlignment.end, - primaryItems: [ - CommandBarButton( - icon: Icon(FluentIcons.share), - onPressed: () async { - var url = widget.spotlight!.articleUrl; - await launchUrl(Uri.tryParse(url)!); - }, - ) - ], - ) - : null, - ), - content: Observer(builder: (context) { - return buildBlocProvider(); - }), - ); - } - - Widget buildBlocProvider() { - if (_soupStore.amWorks.isEmpty) return Container(); - final count = (MediaQuery.of(context).orientation == Orientation.portrait) - ? userSetting.crossCount - : userSetting.hCrossCount; - - return CustomScrollView( - slivers: [ - SliverWaterfallFlow( - gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount( - crossAxisCount: count, - ), - delegate: SliverChildBuilderDelegate( - (BuildContext context, int index) { - return Builder(builder: (context) { - if (index == 0) { - if (_soupStore.description == null || - _soupStore.description!.isEmpty) - return Container( - height: 1, - ); - return Card( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text(_soupStore.description ?? ''), - ), - ); - } - AmWork amWork = _soupStore.amWorks[index - 1]; - return PixEzButton( - child: Card( - padding: EdgeInsets.zero, - child: Column( - children: [ - PixivImage(amWork.showImage!), - ListTile( - leading: PainterAvatar( - url: amWork.userImage!, - id: int.parse(Uri.parse(amWork.userLink!) - .pathSegments[Uri.parse(amWork.userLink!) - .pathSegments - .length - - 1]), - ), - title: Text(amWork.title!), - subtitle: Text(amWork.user!), - ), - ], - ), - ), - onPressed: () { - int id = int.parse(Uri.parse(amWork.arworkLink!) - .pathSegments[ - Uri.parse(amWork.arworkLink!).pathSegments.length - 1]); - Leader.push( - context, - IllustLightingPage( - id: id, - store: IllustStore(id, null), - ), - icon: Icon(FluentIcons.picture), - title: Text(I18n.of(context).illust_id + ': ${id}'), - ); - }, - ); - }); - }, - childCount: _soupStore.amWorks.length + 1, - ), - ) - ], - ); - } -} diff --git a/lib/fluent/page/splash/splash_page.dart b/lib/fluent/page/splash/splash_page.dart deleted file mode 100644 index 2239270c9..000000000 --- a/lib/fluent/page/splash/splash_page.dart +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:mobx/mobx.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/lighting/lighting_store.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/network/api_client.dart'; -import 'package:pixez/network/oauth_client.dart'; - -class SplashPage extends StatefulWidget { - @override - _SplashPageState createState() => _SplashPageState(); -} - -class _SplashPageState extends State - with SingleTickerProviderStateMixin { - late AnimationController controller; - LightingStore? lightingStore; - - @override - void initState() { - if (accountStore.now != null) - lightingStore = - LightingStore(ApiSource(futureGet: () => apiClient.getRecommend())); - controller = - AnimationController(duration: Duration(seconds: 2), vsync: this); - initMethod(); - super.initState(); - controller.forward(); - } - - late ReactionDisposer reactionDisposer, userDisposer; - - bool isPush = false; - - initMethod() { - userDisposer = reaction((_) => userSetting.disableBypassSni, (_) { - if (userSetting.disableBypassSni) { - apiClient.httpClient.options.baseUrl = - 'https://${ApiClient.BASE_API_URL_HOST}'; - oAuthClient.httpClient.options.baseUrl = - 'https://${OAuthClient.BASE_OAUTH_URL_HOST}'; - Leader.pushUntilHome(context); - isPush = true; - } - }); - reactionDisposer = reaction((_) => splashStore.helloWord, (_) { - if (mounted && !isPush) { - Leader.pushUntilHome(context); - isPush = true; - } - }); - splashStore.hello(); - } - - @override - void dispose() { - controller.dispose(); - userDisposer(); - reactionDisposer(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - content: Column( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - RotationTransition( - child: Image.asset( - 'assets/images/icon.png', - height: 80, - width: 80, - ), - alignment: Alignment.center, - turns: controller), - Container( - child: Text( - splashStore.helloWord, - textAlign: TextAlign.center, - ), - ) - ], - ), - ); - } -} diff --git a/lib/fluent/page/spotlight/spotlight_page.dart b/lib/fluent/page/spotlight/spotlight_page.dart deleted file mode 100644 index 922e54073..000000000 --- a/lib/fluent/page/spotlight/spotlight_page.dart +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:easy_refresh/easy_refresh.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/component/pixez_default_header.dart'; -import 'package:pixez/fluent/component/spotlight_card.dart'; -import 'package:pixez/utils.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/page/hello/recom/spotlight_store.dart'; -import 'package:waterfall_flow/waterfall_flow.dart'; - -class SpotLightPage extends StatelessWidget { - @override - Widget build(BuildContext context) { - final ScrollController _controller = ScrollController(); - final EasyRefreshController _refreshController = EasyRefreshController( - controlFinishLoad: true, controlFinishRefresh: true); - final SpotlightStore _spotlightStore = SpotlightStore(_refreshController); - - initializeScrollController(_controller, _spotlightStore.next); - _spotlightStore.fetch(); - return Observer(builder: (_) { - return ScaffoldPage( - header: PageHeader( - title: Text(I18n.of(context).spotlight), - commandBar: CommandBar( - mainAxisAlignment: MainAxisAlignment.end, - primaryItems: [ - CommandBarButton( - icon: Icon(FluentIcons.up), - onPressed: () { - _controller.animateTo(0, - duration: Duration(seconds: 1), curve: Curves.ease); - }, - ) - ], - ), - ), - content: EasyRefresh( - onLoad: () => _spotlightStore.next(), - onRefresh: () => _spotlightStore.fetch(), - header: PixezDefault.header(context), - refreshOnStart: true, - controller: _refreshController, - child: WaterfallFlow.builder( - gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount( - crossAxisCount: 4), - controller: _controller, - itemBuilder: (BuildContext context, int index) { - return SpotlightCard( - spotlight: _spotlightStore.articles[index]); - }, - itemCount: _spotlightStore.articles.length, - )), - ); - }); - } -} diff --git a/lib/fluent/page/task/job_page.dart b/lib/fluent/page/task/job_page.dart deleted file mode 100644 index f0560f094..000000000 --- a/lib/fluent/page/task/job_page.dart +++ /dev/null @@ -1,535 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -import 'dart:async'; - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/fluent/component/pixez_button.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/fluent/component/sort_group.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/task_persist.dart'; -import 'package:pixez/fluent/page/picture/illust_lighting_page.dart'; -import 'package:pixez/store/save_store.dart'; - -class JobPage extends StatefulWidget { - @override - _JobPageState createState() => _JobPageState(); -} - -class _JobPageState extends State with SingleTickerProviderStateMixin { - List _list = []; - TaskPersistProvider taskPersistProvider = TaskPersistProvider(); - Timer? _timer; - late AnimationController rotationController; - ScrollController _scrollController = ScrollController(); - bool _itemSimple = true; - int STATUS_ALL = 10; - - @override - void initState() { - rotationController = AnimationController( - duration: const Duration(milliseconds: 500), vsync: this); - _scrollController.addListener(() async { - if (_scrollController.hasClients) { - if (_scrollController.offset >= - _scrollController.position.maxScrollExtent) { - await _next(); - } - } - }); - super.initState(); - initMethod(); - } - - @override - void dispose() { - _scrollController.dispose(); - rotationController.dispose(); - _timer?.cancel(); - super.dispose(); - } - - initMethod() async { - await taskPersistProvider.open(); - _refresh(); - _timer = Timer.periodic(Duration(seconds: 1), (time) { - _fetchLocal(); - }); - } - - _fetchLocal() async { - if (mounted) { - setState(() { - if (currentIndex == 1) { - _list = fetcher.queue - .where((element) => fetcher.urlPool.contains(element.url)) - .map((e) => TaskPersist( - userName: e.illusts?.user.name ?? "", - title: e.illusts?.title ?? "", - url: e.url ?? "", - userId: e.illusts?.user.id ?? 0, - illustId: e.illusts?.id ?? 0, - fileName: e.fileName ?? "", - status: 1)) - .toList(); - } - }); - } - } - - _refresh() async { - _page = 0; - _endOfPage = false; - final results = await taskPersistProvider.getDownloadTask( - _page, toTaskStatus(currentIndex), asc); - if (mounted) { - setState(() { - _list = results; - }); - } - } - - _reQueryFilter() async { - final results = await taskPersistProvider.getDownloadTask( - _page, toTaskStatus(currentIndex), asc); - if (mounted) { - setState(() { - _list = results; - }); - } - } - - bool _nextLoading = false; - bool _endOfPage = false; - - _next() async { - if (_nextLoading || _endOfPage) return; - _nextLoading = true; - _page++; - final results = await taskPersistProvider.getDownloadTask( - _page, toTaskStatus(currentIndex), asc); - _endOfPage = results.length < 16; - _nextLoading = false; - if (mounted) { - setState(() { - _list += results; - }); - } - } - - int toTaskStatus(int index) { - switch (index) { - case 1: - return 1; - case 2: - return 2; - case 3: - return 3; - default: - return STATUS_ALL; - } - } - - String toMessage(int i) { - switch (i) { - case 0: - return "seed"; - case 1: - return I18n.of(context).running; - case 2: - return I18n.of(context).complete; - case 3: - return I18n.of(context).failed; - default: - return "seed"; - } - } - - Widget _buildStatusWidget(int i) { - switch (i) { - case 0: - return Text("seed", - style: FluentTheme.of(context) - .typography - .body! - .copyWith(fontSize: 12)); - case 1: - return Text(I18n.of(context).running, - style: FluentTheme.of(context) - .typography - .body! - .copyWith(fontSize: 12)); - case 2: - return Icon( - FluentIcons.check_mark, - color: Colors.green, - size: 16, - ); - case 3: - return Icon( - FluentIcons.error, - size: 16, - ); - default: - return Text( - "seed", - style: - FluentTheme.of(context).typography.body!.copyWith(fontSize: 16), - ); - } - } - - bool asc = false; - - @override - Widget build(BuildContext context) { - return ContentDialog( - title: PageHeader( - title: Text(I18n.of(context).task_progress), - commandBar: CommandBar( - mainAxisAlignment: MainAxisAlignment.end, - primaryItems: [ - CommandBarButton( - onPressed: () { - setState(() { - _itemSimple = !_itemSimple; - }); - }, - icon: (_itemSimple - ? Icon(FluentIcons.picture) - : Icon(FluentIcons.hide3)), - ), - CommandBarButton( - onPressed: () { - if (asc) - rotationController.forward(); - else - rotationController.reverse(); - setState(() { - asc = !asc; - }); - _reQueryFilter(); - }, - icon: RotationTransition( - turns: Tween(begin: 0.0, end: 0.5).animate(rotationController), - child: Icon(FluentIcons.sort_down), - ), - ), - ], - secondaryItems: [ - CommandBarButton( - label: Text(I18n.of(context).retry_failed_tasks), - onPressed: () async { - final results = await taskPersistProvider.getAllAccount(); - results.forEach((element) { - if (element.status == 3) { - _retryJob(element); - } - }); - initMethod(); - }, - ), - CommandBarButton( - label: Text(I18n.of(context).retry_seed_task), - onPressed: () async { - final results = await taskPersistProvider.getAllAccount(); - results.forEach((element) { - if (element.status == 0) { - _retryJob(element); - } - }); - initMethod(); - }, - ), - CommandBarButton( - label: Text(I18n.of(context).clear_completed_tasks), - onPressed: () async { - final results = await taskPersistProvider.getAllAccount(); - results.forEach((element) { - if (element.status == 2) { - _deleteJob(element); - } - }); - initMethod(); - }, - ) - ], - ), - ), - content: SafeArea( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildTopChip(), - Expanded(child: _body()), - ], - ), - ), - actions: [ - FilledButton( - child: Text(I18n.of(context).ok), - onPressed: Navigator.of(context).pop, - ), - ], - ); - } - - int currentIndex = 0; - int _page = 0; - - Widget _buildTopChip() { - return SortGroup( - children: [ - I18n.of(context).all, - I18n.of(context).running, - I18n.of(context).complete, - I18n.of(context).failed, - ], - onChange: (index) { - _scrollController.jumpTo(0); - setState(() { - this.currentIndex = index; - if (currentIndex == 1) { - _list = fetcher.queue - .where((element) => fetcher.urlPool.contains(element.url)) - .map((e) => TaskPersist( - userName: e.illusts?.user.name ?? "", - title: e.illusts?.title ?? "", - url: e.url ?? "", - userId: e.illusts?.user.id ?? 0, - illustId: e.illusts?.id ?? 0, - fileName: e.fileName ?? "", - status: 1)) - .toList(); - } else { - _refresh(); - } - }); - }, - ); - } - - Widget _body() { - final trueList = asc ? _list.reversed.toList() : _list; - return ListView.builder( - controller: _scrollController, - itemBuilder: (context, index) { - if (trueList.isEmpty) - return Container( - height: MediaQuery.of(context).size.width, - child: Center( - child: Text( - "[ ]", - style: FluentTheme.of(context) - .typography - .body! - .copyWith(fontSize: 24), - ), - ), - ); - return _buildItem(trueList[index], index); - }, - itemCount: (trueList.isEmpty) ? 1 : trueList.length, - ); - } - - Widget _buildItem(TaskPersist taskPersist, int index) { - JobEntity? jobEntity = fetcher.jobMaps[taskPersist.url]; - if (currentIndex != 0) { - if ((jobEntity?.status ?? taskPersist.status) != currentIndex) - return Visibility( - child: Container( - height: 0, - ), - visible: false, - ); - } - return PixEzButton( - onPressed: () { - Leader.push( - context, - IllustLightingPage(id: taskPersist.illustId), - icon: const Icon(FluentIcons.picture), - title: Text(I18n.of(context).illust_id + ': ${taskPersist.illustId}'), - ); - }, - child: Card( - padding: EdgeInsets.zero, - child: Stack( - children: [ - Row( - children: [ - (!_itemSimple) - ? Container( - child: Stack( - children: [ - Container( - height: 100, - width: 100, - child: PixivImage( - taskPersist.medium ?? taskPersist.url, - fit: BoxFit.cover, - height: 100, - width: 100, - ), - ), - (jobEntity != null && jobEntity.status != 2) - ? Container( - height: 100, - width: 100, - child: Center( - child: ProgressRing( - value: ((jobEntity.min ?? 0.0) / - ((jobEntity.max ?? 0.0))) - .toDouble(), - backgroundColor: Colors.grey[200], - ), - ), - ) - : Container( - height: 100, - width: 100, - ), - ], - ), - width: 100, - height: 100, - ) - : Container( - width: 8, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - taskPersist.title, - maxLines: 1, - overflow: TextOverflow.clip, - ), - ), - ), - if (_itemSimple) ...[ - PixEzButton( - onPressed: () { - _retryJob(taskPersist); - }, - child: Icon(FluentIcons.refresh)), - Padding( - padding: const EdgeInsets.all(8.0), - child: PixEzButton( - onPressed: () { - _deleteJob(taskPersist); - }, - child: Icon(FluentIcons.delete)), - ), - ], - Padding( - padding: const EdgeInsets.only(right: 16.0), - child: _buildStatusWidget( - jobEntity?.status ?? taskPersist.status), - ), - ], - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Text( - taskPersist.userName, - style: - FluentTheme.of(context).typography.body?.copyWith( - color: FluentTheme.of(context).accentColor, - fontSize: 12, - ), - ), - ), - (!_itemSimple) - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text(" "), - Row( - children: [ - PixEzButton( - onPressed: () { - _retryJob(taskPersist); - }, - child: Icon(FluentIcons.refresh)), - Padding( - padding: const EdgeInsets.all(8.0), - child: PixEzButton( - onPressed: () { - _deleteJob(taskPersist); - }, - child: Icon(FluentIcons.delete)), - ), - ], - ) - ], - ) - : Container( - height: 10, - ), - ], - ), - ), - ], - ), - (jobEntity != null && jobEntity.status != 2) - ? Positioned( - left: 0.0, - right: 0.0, - bottom: 0.0, - child: ProgressBar( - value: ((jobEntity.min ?? 0.0) / ((jobEntity.max ?? 0.0))) - .toDouble(), - backgroundColor: Colors.grey[200], - ), - ) - : Container(), - ], - ), - ), - ); - } - - Future _deleteJob(TaskPersist persist) async { - await taskPersistProvider.remove(persist.id!); - fetcher.jobMaps.remove(persist.url); - fetcher.queue.removeWhere((element) => element.url == persist.url); - setState(() { - _list.removeWhere((element) => element.id == persist.id); - }); - } - - Future _retryJob(TaskPersist persist) async { - if (persist.status == 2) return; - await _deleteJob(persist); - final taskPersist = persist; - await taskPersistProvider.insert(taskPersist); - await fetcher.save(persist.url, taskPersist.toIllusts(), persist.fileName); - _refresh(); - } -} diff --git a/lib/fluent/page/theme/theme_page.dart b/lib/fluent/page/theme/theme_page.dart deleted file mode 100644 index ce9e73a80..000000000 --- a/lib/fluent/page/theme/theme_page.dart +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/component/picker/colorpicker.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; - -class ColorPickPage extends StatefulWidget { - final Color initialColor; - - ColorPickPage({required this.initialColor}); - - @override - _ColorPickPageState createState() => _ColorPickPageState(); -} - -class _ColorPickPageState extends State { - late Color pickerColor; - @override - void initState() { - pickerColor = widget.initialColor; - super.initState(); - } - - @override - Widget build(BuildContext context) { - return ContentDialog( - title: PageHeader( - title: Text(I18n.of(context).pick_a_color), - commandBar: CommandBar( - primaryItems: [ - CommandBarButton( - icon: Icon(FluentIcons.edit), - onPressed: () async { - final TextEditingController textEditingController = - TextEditingController( - text: pickerColor.value - .toString() - .toLowerCase() - .replaceAll('color(0xff', '') - .replaceAll(')', '')); - - String? result = await showDialog( - context: context, - builder: (context) { - return ContentDialog( - title: Text("16 radix RGB"), - content: TextBox( - controller: textEditingController, - maxLength: 6, - prefix: Text("color(0xff"), - suffix: Text(")")), - actions: [ - Button( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text(I18n.of(context).cancel)), - FilledButton( - onPressed: () { - final result = textEditingController.text - .trim() - .toLowerCase(); - if (result.length != 6) { - return; - } - Navigator.of(context) - .pop("color(0xff${result})"); - }, - child: Text(I18n.of(context).ok)), - ], - ); - }); - if (result == null) return; - Color color = _stringToColor(result); //迅速throw出来 - setState(() { - pickerColor = color; - }); - }), - ], - ), - ), - content: Container( - width: 800, - child: ColorPicker( - enableAlpha: false, - pickerColor: pickerColor, - onColorChanged: (Color color) { - setState(() { - pickerColor = color; - }); - }, - pickerAreaHeightPercent: 0.8, - ), - ), - actions: [ - FilledButton( - child: Text(I18n.of(context).save), - onPressed: () { - Navigator.of(context).pop(pickerColor); - }, - ), - ], - ); - } - - Color _stringToColor(String colorString) { - String valueString = - colorString.split('(0x')[1].split(')')[0]; // kind of hacky.. - int value = int.parse(valueString, radix: 16); - Color otherColor = new Color(value); - return otherColor; - } -} - -class ThemePage extends StatefulWidget { - @override - _ThemePageState createState() => _ThemePageState(); -} - -class _ThemePageState extends State with TickerProviderStateMixin { - final skinList = [ - FluentThemeData( - brightness: Brightness.light, - accentColor: Color(0xFF26C6DA).toAccentColor(), - ), - FluentThemeData( - brightness: Brightness.light, - accentColor: Color(0xFFEC407A).toAccentColor(), - ), - FluentThemeData( - brightness: Brightness.light, - accentColor: Color(0xFF66BB6A).toAccentColor(), - ), - FluentThemeData( - brightness: Brightness.light, - accentColor: Color(0xFF8D6E63).toAccentColor(), - ), - FluentThemeData( - brightness: Brightness.light, - accentColor: Color(0xFFAB47BC).toAccentColor(), - ), - FluentThemeData( - brightness: Brightness.light, - accentColor: Color(0xFF42A5F5).toAccentColor(), - ), - FluentThemeData( - brightness: Brightness.light, - accentColor: Color(0xFFFB7299).toAccentColor(), - ), - ]; - - Future _pickColorData(int index, Color pickerColor) async { - // TODO: 不支持 Color Picker - // Color? result = await showDialog( - // context: context, - // builder: (context) => ColorPickPage(initialColor: pickerColor), - // useRootNavigator: false, - // ); - // if (result != null) { - // var data = [ - // userSetting.themeData.primaryColor.toString(), - // userSetting.themeData.primaryColor.toString(), - // ]; - // data[index] = "(0x${result.value.toRadixString(16)})"; - // userSetting.setThemeData(data); - // } - } - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Observer(builder: (context) { - return ContentDialog( - title: Text(I18n.of(context).skin), - content: ListView( - children: [ - ComboBox( - items: [ - ComboBoxItem(child: Text(I18n.of(context).system), value: 0), - ComboBoxItem(child: Text(I18n.of(context).light), value: 1), - ComboBoxItem(child: Text(I18n.of(context).dark), value: 2), - ], - value: ThemeMode.values.indexOf(userSetting.themeMode), - onChanged: (i) { - if (i == null) return; - userSetting.setThemeMode(i); - }, - ), - Observer(builder: (_) { - return Card( - child: ToggleSwitch( - checked: userSetting.isAMOLED, - onChanged: (v) => userSetting.setIsAMOLED(v), - content: Text("AMOLED"), - )); - }), - Card( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Text( - FluentTheme.of(context).accentColor.toString(), - style: - TextStyle(color: FluentTheme.of(context).accentColor), - ), - ), - Column( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - onPressed: () { - _pickColorData(0, FluentTheme.of(context).accentColor); - }, - icon: Container( - height: 30, - color: FluentTheme.of(context).accentColor, - child: Center(child: Text("accentColor")), - ), - ), - ], - ), - ], - )), - GridView.builder( - shrinkWrap: true, - itemCount: skinList.length, - physics: NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2), - itemBuilder: (context, index) { - final skin = skinList[index]; - return Card( - margin: const EdgeInsets.all(2.0), - padding: EdgeInsets.zero, - child: IconButton( - onPressed: () { - userSetting.setThemeData(skin.accentColor); - }, - icon: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Text( - skin.accentColor.toString(), - style: TextStyle(color: skin.accentColor), - ), - ), - Column( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - height: 30, - color: skin.accentColor, - child: Center(child: Text("accentColor")), - ), - ], - ), - ], - ), - ), - ); - }) - ], - ), - actions: [ - FilledButton( - child: Text(I18n.of(context).ok), - onPressed: () => Navigator.of(context).pop(), - ), - ], - ); - }); - } -} diff --git a/lib/fluent/page/user/bookmark/bookmark_page.dart b/lib/fluent/page/user/bookmark/bookmark_page.dart deleted file mode 100644 index ad934268a..000000000 --- a/lib/fluent/page/user/bookmark/bookmark_page.dart +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:async'; - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/fluent/component/sort_group.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/fluent/lighting/fluent_lighting_page.dart'; -import 'package:pixez/lighting/lighting_store.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/network/api_client.dart'; -import 'package:pixez/fluent/page/user/bookmark/tag/user_bookmark_tag_page.dart'; - -class BookmarkPage extends StatefulWidget { - final int id; - final String restrict; - final bool isNested; - final BookmarkPageMethodRelay relay; - - const BookmarkPage({ - Key? key, - required this.id, - required this.relay, - this.restrict = "public", - this.isNested = false, - }) : super(key: key); - - @override - _BookmarkPageState createState() => _BookmarkPageState(); -} - -class BookmarkPageMethodRelay { - late Function sort; -} - -class _BookmarkPageState extends State { - late LightSource futureGet; - String restrict = 'public'; - late ScrollController _scrollController; - late StreamSubscription subscription; - - @override - void initState() { - this.widget.relay.sort = sort; - _scrollController = ScrollController(); - restrict = widget.restrict; - futureGet = ApiForceSource( - futureGet: (e) => - apiClient.getBookmarksIllust(widget.id, restrict, null)); - super.initState(); - subscription = topStore.topStream.listen((event) { - if (event == "302") { - if (_scrollController.hasClients) _scrollController.position.jumpTo(0); - } - }); - } - - @override - void dispose() { - subscription.cancel(); - _scrollController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - if (accountStore.now != null) { - if (int.parse(accountStore.now!.userId) == widget.id) { - return Stack( - children: [ - LightingList( - source: futureGet, - scrollController: _scrollController, - isNested: widget.isNested, - header: Container( - height: 45, - ), - ), - buildTopChip(context) - ], - ); - } - return LightingList( - isNested: widget.isNested, - scrollController: _scrollController, - source: futureGet, - ); - } else { - return Container(); - } - } - - Widget buildTopChip(BuildContext context) { - return Align( - alignment: Alignment.topCenter, - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SortGroup( - children: [I18n.of(context).public, I18n.of(context).private], - onChange: (index) { - if (index == 0) - setState(() { - futureGet = ApiForceSource( - futureGet: (bool e) => apiClient.getBookmarksIllust( - widget.id, restrict = 'public', null)); - }); - if (index == 1) - setState(() { - futureGet = ApiForceSource( - futureGet: (bool e) => apiClient.getBookmarksIllust( - widget.id, restrict = 'private', null)); - }); - }, - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: IconButton( - onPressed: () async { - final result = await Leader.push( - context, - UserBookmarkTagPage(), - title: Text(I18n.of(context).tag), - icon: Icon(FluentIcons.sort), - ); - if (result == null || result.runtimeType == StatefulElement) { - return; - } - String? tag = result['tag']; - String restrict = result['restrict']; - setState(() { - futureGet = ApiForceSource( - futureGet: (bool e) => apiClient.getBookmarksIllust( - widget.id, restrict, tag)); - }); - }, - icon: Icon(FluentIcons.sort), - ), - ), - ], - ), - ); - } - - Future sort() async { - final result = await Leader.push( - context, - UserBookmarkTagPage(), - icon: Icon(FluentIcons.sort), - title: Text(I18n.of(context).tag), - ); - if (result != null) { - String? tag = result['tag']; - String restrict = result['restrict']; - setState(() { - futureGet = ApiForceSource( - futureGet: (bool e) => - apiClient.getBookmarksIllust(widget.id, restrict, tag)); - }); - } - } -} diff --git a/lib/fluent/page/user/bookmark/tag/user_bookmark_tag_page.dart b/lib/fluent/page/user/bookmark/tag/user_bookmark_tag_page.dart deleted file mode 100644 index e11a14573..000000000 --- a/lib/fluent/page/user/bookmark/tag/user_bookmark_tag_page.dart +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:easy_refresh/easy_refresh.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/page/user/bookmark/tag/bookmark_tag_store.dart'; - -class UserBookmarkTagPage extends StatefulWidget { - @override - _UserBookmarkTagPageState createState() => _UserBookmarkTagPageState(); -} - -class _UserBookmarkTagPageState extends State - with SingleTickerProviderStateMixin { - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader( - title: Text(I18n.of(context).tag), - ), - content: NavigationView( - pane: NavigationPane(items: [ - PaneItem( - icon: Icon(FluentIcons.public_folder), - title: Text(I18n.of(context).public), - body: NewWidget( - restrict: "public", - ), - ), - PaneItem( - icon: Icon(FluentIcons.lock), - title: Text(I18n.of(context).private), - body: NewWidget( - restrict: "private", - ), - ), - ], displayMode: PaneDisplayMode.top)), - ); - } -} - -class NewWidget extends StatelessWidget { - final String restrict; - - const NewWidget({Key? key, required this.restrict}) : super(key: key); - - @override - Widget build(BuildContext context) { - final EasyRefreshController _easyRefreshController = EasyRefreshController( - controlFinishLoad: true, controlFinishRefresh: true); - BookMarkTagStore _bookMarkTagStore = BookMarkTagStore( - int.parse(accountStore.now!.userId), _easyRefreshController); - return Observer(builder: (_) { - return EasyRefresh( - controller: _easyRefreshController, - refreshOnStart: true, - child: ListView.builder( - itemBuilder: (context, index) { - if (index == 0) - return ListTile( - title: Text(I18n.of(context).all), - onPressed: () { - Navigator.pop(context, {"tag": null, "restrict": restrict}); - }, - ); - else if (index == 1) - return ListTile( - title: Text(I18n.of(context).unclassified), - onPressed: () { - Navigator.pop( - context, {"tag": "未分類", "restrict": restrict}); //日语 - }, - ); - var bookmarkTag = _bookMarkTagStore.bookmarkTags[index - 2]; - return ListTile( - title: Text(bookmarkTag.name), - trailing: Text(bookmarkTag.count.toString()), - onPressed: () { - Navigator.pop( - context, {"tag": bookmarkTag.name, "restrict": restrict}); - }, - ); - }, - itemCount: _bookMarkTagStore.bookmarkTags.length + 2, - ), - onRefresh: () async { - await _bookMarkTagStore.fetch(restrict); - }, - onLoad: () async { - await _bookMarkTagStore.next(); - }, - ); - }); - } -} diff --git a/lib/fluent/page/user/detail/user_detail.dart b/lib/fluent/page/user/detail/user_detail.dart deleted file mode 100644 index 0fa428ca9..000000000 --- a/lib/fluent/page/user/detail/user_detail.dart +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter/services.dart'; -import 'package:pixez/fluent/component/selectable_html.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/models/user_detail.dart'; -import 'package:pixez/fluent/page/follow/follow_list.dart'; -import 'package:share_plus/share_plus.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class UserDetailPage extends StatefulWidget { - final UserDetail userDetail; - - const UserDetailPage({Key? key, required this.userDetail}) : super(key: key); - - @override - _UserDetailPageState createState() => _UserDetailPageState(); -} - -class _UserDetailPageState extends State { - @override - Widget build(BuildContext context) { - var detail = widget.userDetail; - var profile = widget.userDetail.profile; - var public = widget.userDetail.profile_publicity; - return SelectionArea( - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Card( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: widget.userDetail.user.comment != null && - widget.userDetail.user.comment!.isNotEmpty - ? SelectableHtml(data: widget.userDetail.user.comment!) - : SelectableHtml( - data: '~', - )), - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Table( - children: [ - TableRow(children: [ - Text(I18n.of(context).nickname), - Text(detail.user.name, textAlign: TextAlign.center) - ]), - TableRow(children: [ - Text(I18n.of(context).painter_id), - HyperlinkButton( - child: Text(detail.user.id.toString()), - onPressed: () { - try { - Clipboard.setData( - ClipboardData(text: detail.user.id.toString()), - ); - } catch (e) {} - }), - ]), - TableRow(children: [ - Text(I18n.of(context).total_follow_users), - HyperlinkButton( - child: - Text(detail.profile.total_follow_users.toString()), - onPressed: () { - Leader.push( - context, - ScaffoldPage( - header: PageHeader( - title: Text(I18n.of(context).followed), - ), - content: FollowList( - id: widget.userDetail.user.id, - ), - ), - icon: Icon(FluentIcons.follow_user), - title: Text(I18n.of(context).followed), - ); - }), - ]), - TableRow(children: [ - Text(I18n.of(context).total_mypixiv_users), - HyperlinkButton( - child: - Text(detail.profile.total_mypixiv_users.toString()), - onPressed: () { - Leader.push( - context, - ScaffoldPage( - header: PageHeader( - title: Text(I18n.of(context).followed), - ), - content: FollowList( - id: widget.userDetail.user.id, - isFollowMe: true, - ), - ), - icon: Icon(FluentIcons.follow_user), - title: Text(I18n.of(context).followed), - ); - }), - ]), - TableRow(children: [ - Text(I18n.of(context).twitter_account), - HyperlinkButton( - child: Text(profile.twitter_account ?? ""), - onPressed: () async { - final url = profile.twitter_url; - if (url == null) return; - - try { - await launchUrl(Uri.parse(url)); - } catch (e) { - Share.share(url); - } - }), - ]), - TableRow(children: [ - Text(I18n.of(context).gender), - Text( - detail.profile.gender ?? '', - textAlign: TextAlign.center, - ), - ]), - TableRow(children: [ - Text(I18n.of(context).job), - Text( - detail.profile.job ?? '', - textAlign: TextAlign.center, - ), - ]), - TableRow(children: [ - Text('Pawoo'), - HyperlinkButton( - child: Text(public.pawoo ? 'Link' : 'none'), - onPressed: () async { - if (!public.pawoo) return; - var url = detail.profile.pawoo_url; - if (url == null) return; - try { - await launchUrl(Uri.parse(url)); - } catch (e) {} - }), - ]), - ], - ), - ), - Container( - height: 200, - ) - ], - ), - ), - ); - } -} diff --git a/lib/fluent/page/user/users_page.dart b/lib/fluent/page/user/users_page.dart deleted file mode 100644 index 486d0ba8b..000000000 --- a/lib/fluent/page/user/users_page.dart +++ /dev/null @@ -1,601 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:io'; - -import 'package:bot_toast/bot_toast.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:dio/dio.dart'; -import 'package:dio/io.dart'; -import 'package:fluent_ui/fluent_ui.dart' hide NestedScrollView; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:path_provider/path_provider.dart'; -import 'package:pixez/fluent/component/context_menu.dart'; -import 'package:pixez/fluent/component/painter_avatar.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/component/null_hero.dart'; -import 'package:pixez/document_plugin.dart'; -import 'package:pixez/er/hoster.dart'; -import 'package:pixez/er/leader.dart'; -import 'package:pixez/exts.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/illust.dart'; -import 'package:pixez/fluent/page/follow/follow_list.dart'; -import 'package:pixez/fluent/page/report/report_items_page.dart'; -import 'package:pixez/fluent/page/shield/shield_page.dart'; -import 'package:pixez/fluent/page/user/bookmark/bookmark_page.dart'; -import 'package:pixez/fluent/page/user/detail/user_detail.dart'; -import 'package:pixez/fluent/page/user/works/works_page.dart'; -import 'package:pixez/fluent/page/zoom/zoom_page.dart'; -import 'package:pixez/page/user/user_store.dart'; -import 'package:share_plus/share_plus.dart'; - -class UsersPage extends StatefulWidget { - final int id; - final UserStore? userStore; - final String? heroTag; - - const UsersPage({Key? key, required this.id, this.userStore, this.heroTag}) - : super(key: key); - - @override - _UsersPageState createState() => _UsersPageState(); -} - -class _UsersPageState extends State - with SingleTickerProviderStateMixin { - late UserStore userStore; - late ScrollController _scrollController; - bool backToTopVisible = false; - BookmarkPageMethodRelay _bookmarkPageMethodRelay = BookmarkPageMethodRelay(); - - @override - void initState() { - userStore = widget.userStore ?? UserStore(widget.id, null, null); - _scrollController = ScrollController(); - _scrollController.addListener(() { - if (_scrollController.hasClients) { - if (_scrollController.offset > 100) { - if (!backToTopVisible) { - setState(() { - backToTopVisible = true; - }); - } - } else { - if (backToTopVisible) { - setState(() { - backToTopVisible = false; - }); - } - } - } - }); - super.initState(); - userStore.firstFetch(); - muteStore.fetchBanUserIds(); - } - - @override - void dispose() { - _scrollController.dispose(); - super.dispose(); - } - - int _tabIndex = 0; - - @override - Widget build(BuildContext context) { - return Observer(builder: (_) { - if (muteStore.banUserIds.isNotEmpty) { - if (muteStore.banUserIds - .map((element) => int.parse(element.userId!)) - .contains(widget.id)) { - return ScaffoldPage( - content: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text('X_X'), - Text('${widget.id}'), - FilledButton( - child: Text(I18n.of(context).shielding_settings), - onPressed: () { - Leader.push( - context, - ShieldPage(), - icon: Icon(FluentIcons.settings), - title: Text(I18n.of(context).shielding_settings), - ); - }, - ) - ], - ), - ), - ); - } - } - - if (userStore.errorMessage != null) { - if (userStore.errorMessage!.contains("404")) - return ScaffoldPage( - content: Container( - child: Center( - child: Text('404 not found'), - )), - ); - return ScaffoldPage( - content: Container( - child: Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - 'Http error\n${userStore.errorMessage}', - maxLines: 5, - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: FilledButton( - onPressed: () { - userStore.errorMessage = null; - userStore.firstFetch(); - }, - child: Text(I18n.of(context).refresh), - ), - ) - ], - ), - )), - ); - } - if (userStore.user == null) { - return ScaffoldPage( - content: Container( - child: Center( - child: ProgressRing(), - )), - ); - } - return NavigationView( - pane: NavigationPane( - displayMode: PaneDisplayMode.top, - selected: _tabIndex, - onChanged: (value) { - if (value > 2) return; - _tabIndex = value; - setState(() {}); - }, - items: [ - PaneItem( - icon: Icon(FluentIcons.info), - title: Text(I18n.of(context).detail), - body: _buildDetail(context)), - PaneItem( - icon: Icon(FluentIcons.picture_library), - title: Text(I18n.of(context).works), - body: WorksPage( - id: widget.id, - ), - ), - PaneItem( - icon: Icon(FluentIcons.bookmarks), - title: Text(I18n.of(context).bookmark), - body: BookmarkPage( - isNested: true, - id: widget.id, - relay: _bookmarkPageMethodRelay, - ), - ), - ], - footerItems: [ - PaneItemAction( - icon: Icon(FluentIcons.share), - onTap: () => - Share.share('https://www.pixiv.net/users/${widget.id}'), - ), - PaneItemExpander( - icon: Container(), - body: Container(), - items: [ - PaneItemAction( - icon: Container(), - title: Text(I18n.of(context).quietly_follow), - onTap: () { - userStore.follow(needPrivate: true); - }, - ), - PaneItemAction( - icon: Container(), - title: Text(I18n.of(context).block_user), - onTap: () async { - await showDialog( - context: context, - builder: (context) => ContentDialog( - title: Text('${I18n.of(context).block_user}?'), - actions: [ - FilledButton( - child: Text(I18n.of(context).ok), - onPressed: () async { - await muteStore.insertBanUserId( - widget.id.toString(), - userStore.userDetail!.user.name); - Navigator.of(context).pop(); - }, - ), - Button( - child: Text(I18n.of(context).cancel), - onPressed: () { - Navigator.of(context).pop(); - }, - ) - ], - ), - ); - }, - ), - PaneItemAction( - icon: Container(), - title: Text(I18n.of(context).copymessage), - onTap: () { - Clipboard.setData(ClipboardData( - text: - 'painter:${userStore.userDetail?.user.name ?? ''}\npid:${widget.id}')); - BotToast.showText( - text: I18n.of(context).copied_to_clipboard); - }, - ), - PaneItemAction( - icon: Container(), - title: Text(I18n.of(context).report), - onTap: () { - Reporter.show( - context, - () async => await muteStore.insertBanUserId( - widget.id.toString(), - userStore.userDetail!.user.name)); - }, - ), - ], - ), - ], - ), - ); - }); - } - - Widget _buildNameFollow(BuildContext context) { - return LayoutBuilder( - builder: (context, constraints) => Container( - color: FluentTheme.of(context).cardColor, - width: constraints.maxWidth, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - NullHero( - tag: userStore.user?.name ?? "" + widget.heroTag.toString(), - child: Text( - userStore.user?.name ?? "", - style: FluentTheme.of(context).typography.subtitle, - ), - ), - IconButton( - onPressed: () { - Leader.push( - context, - ScaffoldPage( - header: PageHeader( - title: Text(I18n.of(context).followed), - ), - content: FollowList(id: widget.id), - ), - icon: Icon(FluentIcons.follow_user), - title: Text(I18n.of(context).followed), - ); - }, - icon: Text( - userStore.userDetail == null - ? "" - : '${userStore.userDetail!.profile.total_follow_users} ${I18n.of(context).follow}', - style: FluentTheme.of(context).typography.caption, - ), - ) - ], - ), - ), - ), - ); - } - - Widget _buildHeader(BuildContext context) { - final follow = () { - if (accountStore.now == null) return; - - if (int.parse(accountStore.now!.userId) != widget.id) { - userStore.follow(needPrivate: false); - } else { - displayInfoBar(context, - builder: (context, VoidCallback) => InfoBar( - title: Text('Who is the most beautiful person in the world?'), - )); - } - }; - - Widget w = Container( - child: Observer( - builder: (_) => Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16.0, vertical: 0.0), - child: NullHero( - tag: userStore.user!.profileImageUrls.medium + - widget.heroTag.toString(), - child: PainterAvatar( - url: userStore.user!.profileImageUrls.medium, - size: Size(80, 80), - onTap: () { - showDialog( - context: context, - builder: (context) { - return ContentDialog( - title: Text(I18n.of(context).save_painter_avatar), - actions: [ - Button( - onPressed: () async { - Navigator.of(context).pop(); - }, - child: Text(I18n.of(context).cancel)), - FilledButton( - onPressed: () async { - Navigator.of(context).pop(); - await _saveUserC(); - }, - child: Text(I18n.of(context).ok)), - ], - ); - }); - }, - id: userStore.user!.id, - ), - ), - ), - Container( - child: userStore.userDetail == null - ? Container( - padding: const EdgeInsets.only(right: 16.0, bottom: 4.0), - child: ProgressRing(), - ) - : Padding( - padding: const EdgeInsets.only(right: 16.0, bottom: 4.0), - child: userStore.isFollow - ? FilledButton( - onPressed: follow, - child: Text(I18n.of(context).followed), - ) - : OutlinedButton( - onPressed: follow, - child: Text(I18n.of(context).follow), - ), - ), - ) - ], - ), - ), - ); - return Stack( - children: [ - Container( - padding: EdgeInsets.only(top: 25), - alignment: Alignment.bottomCenter, - child: SizedBox( - height: 60.0, - child: Container( - color: FluentTheme.of(context) - .acrylicBackgroundColor - .withOpacity(.5), - ), - ), - ), - Align( - child: w, - alignment: Alignment.bottomCenter, - ) - ], - ); - } - - _saveUserBg(String url) async { - try { - final result = await pixivCacheManager.downloadFile(url, authHeaders: { - 'referer': 'https://app-api.pixiv.net/', - }); - final bytes = await result.file.readAsBytes(); - await DocumentPlugin.save(bytes, "${widget.id}_bg.jpg"); - BotToast.showText(text: I18n.of(context).saved); - } catch (e) { - print(e); - } - } - - Future _saveUserC() async { - var url = userStore.userDetail!.user.profileImageUrls.medium; - String meme = url.split(".").last; - if (meme.isEmpty) meme = "jpg"; - var replaceAll = userStore.userDetail!.user.name - .replaceAll("/", "") - .replaceAll("\\", "") - .replaceAll(":", "") - .replaceAll("*", "") - .replaceAll("?", "") - .replaceAll(">", "") - .replaceAll("|", "") - .replaceAll("<", ""); - String fileName = "${replaceAll}_${userStore.userDetail!.user.id}.${meme}"; - try { - String tempFile = (await getTemporaryDirectory()).path + "/$fileName"; - final dio = Dio(BaseOptions(headers: Hoster.header(url: url))); - if (!userSetting.disableBypassSni) { - dio.httpClientAdapter = IOHttpClientAdapter() - ..createHttpClient = () { - return HttpClient() - ..idleTimeout = Duration(seconds: 3) - ..badCertificateCallback = - (X509Certificate cert, String host, int port) => true; - }; - } - await dio.download(url.toTrueUrl(), tempFile, deleteOnError: true); - File file = File(tempFile); - if (file.existsSync()) { - await saveStore.saveToGallery( - file.readAsBytesSync(), - Illusts( - user: User( - id: userStore.userDetail!.user.id, - name: replaceAll, - profileImageUrls: userStore.userDetail!.user.profileImageUrls, - isFollowed: userStore.userDetail!.user.isFollowed, - account: userStore.userDetail!.user.account, - comment: userStore.userDetail!.user.comment, - ), - metaPages: [], - type: '', - width: 0, - series: Object(), - totalBookmarks: 0, - visible: false, - isMuted: false, - sanityLevel: 0, - tags: [], - caption: '', - pageCount: 0, - metaSinglePage: MetaSinglePage(originalImageUrl: ''), - tools: [], - height: 0, - restrict: 0, - createDate: '', - id: 0, - xRestrict: 0, - imageUrls: ImageUrls(squareMedium: '', medium: '', large: ''), - title: '', - isBookmarked: false, - totalView: 0, - illustAIType: 1, - ), - fileName); - BotToast.showText(text: I18n.of(context).complete); - } else - BotToast.showText(text: I18n.of(context).failed); - } catch (e) { - print(e); - } - } - - _buildBackground(BuildContext context) { - return ContextMenu( - child: CachedNetworkImage( - imageUrl: userStore.userDetail!.profile.background_image_url!, - fit: BoxFit.fitWidth, - cacheManager: pixivCacheManager, - httpHeaders: Hoster.header( - url: userStore.userDetail!.profile.background_image_url, - ), - ), - items: [ - MenuFlyoutItem( - text: Text(I18n.of(context).show), - onPressed: () async { - await Leader.push( - context, - ZoomPage( - url: userStore.userDetail!.profile.background_image_url!), - icon: Icon(FluentIcons.picture), - title: Text(I18n.of(context).painter + - (userStore.userDetail?.user.id.toString() ?? ''))); - }, - ), - MenuFlyoutItem( - text: Text(I18n.of(context).save), - onPressed: () async { - await _saveUserBg( - userStore.userDetail!.profile.background_image_url!); - }, - ), - ], - ); - } - - _buildDetail(BuildContext context) => LayoutBuilder( - builder: (context, constraints) { - final width = constraints.maxWidth; - const height = 300.0; - final nobg = - userStore.userDetail?.profile.background_image_url == null; - - final background = nobg - ? Container(color: FluentTheme.of(context).accentColor) - : _buildBackground(context); - - return ListView( - children: [ - Container( - height: height * (nobg ? .55 : 1), - color: FluentTheme.of(context).cardColor, - child: Stack( - children: [ - Container( - width: width, - height: height * (nobg ? .3 : .75), - child: background, - ), - Align( - alignment: Alignment.bottomCenter, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildHeader(context), - Container( - height: height * .25, - color: FluentTheme.of(context).cardColor, - child: _buildNameFollow(context), - ), - ], - ), - ), - ], - ), - ), - userStore.userDetail != null - ? UserDetailPage(userDetail: userStore.userDetail!) - : Container() - ], - ); - }, - ); -} diff --git a/lib/fluent/page/user/works/works_page.dart b/lib/fluent/page/user/works/works_page.dart deleted file mode 100644 index 10b3f4be6..000000000 --- a/lib/fluent/page/user/works/works_page.dart +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/fluent/component/sort_group.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/fluent/lighting/fluent_lighting_page.dart'; -import 'package:pixez/lighting/lighting_store.dart'; -import 'package:pixez/network/api_client.dart'; - -class WorksPage extends StatefulWidget { - final int id; - - const WorksPage({Key? key, required this.id}) : super(key: key); - - @override - _WorksPageState createState() => _WorksPageState(); -} - -class _WorksPageState extends State { - late LightSource futureGet; - - @override - void initState() { - futureGet = ApiForceSource( - futureGet: (bool e) => apiClient.getUserIllusts(widget.id, 'illust')); - super.initState(); - } - - String now = 'illust'; - - @override - Widget build(BuildContext context) { - return Stack( - children: [ - LightingList( - isNested: true, - source: futureGet, - header: Container( - height: 50, - ), - ), - Align( - child: _buildSortChip(), - alignment: Alignment.topCenter, - ), - ], - ); - } - - Widget _buildSortChip() { - return SortGroup( - onChange: (index) { - setState(() { - now = index == 0 ? 'illust' : 'manga'; - futureGet = ApiForceSource( - futureGet: (bool e) => apiClient.getUserIllusts(widget.id, now)); - }); - }, - children: [ - I18n.of(context).illust, - I18n.of(context).manga, - ], - ); - } -} diff --git a/lib/fluent/page/vision/vision_page.dart b/lib/fluent/page/vision/vision_page.dart deleted file mode 100644 index ec478aaf3..000000000 --- a/lib/fluent/page/vision/vision_page.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:fluent_ui/fluent_ui.dart'; - -class VisionPage extends StatefulWidget { - const VisionPage({Key? key}) : super(key: key); - - @override - _VisionPageState createState() => _VisionPageState(); -} - -class _VisionPageState extends State { - @override - Widget build(BuildContext context) { - return ScaffoldPage(); - } -} diff --git a/lib/fluent/page/webview/account_deletion_webview_page.dart b/lib/fluent/page/webview/account_deletion_webview_page.dart deleted file mode 100644 index 41763ac49..000000000 --- a/lib/fluent/page/webview/account_deletion_webview_page.dart +++ /dev/null @@ -1,30 +0,0 @@ -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/i18n.dart'; - -class AccountDeletionPage extends StatefulWidget { - const AccountDeletionPage({Key? key}) : super(key: key); - - @override - State createState() => _AccountDeletionPageState(); -} - -class _AccountDeletionPageState extends State { - @override - Widget build(BuildContext context) { - return ScaffoldPage( - header: PageHeader(title: Text(I18n.of(context).account_deletion)), - content: Text('Not Support') - // InAppWebView( - // initialUrlRequest: - // URLRequest(url: Uri.parse("https://www.pixiv.net/leave_pixiv.php")), - // initialOptions: InAppWebViewGroupOptions( - // crossPlatform: InAppWebViewOptions( - // useShouldOverrideUrlLoading: true, - // ), - // android: AndroidInAppWebViewOptions( - // useHybridComposition: true, - // )), - // ), - ); - } -} diff --git a/lib/fluent/page/zoom/photo_zoom_page.dart b/lib/fluent/page/zoom/photo_zoom_page.dart deleted file mode 100644 index 79be0c045..000000000 --- a/lib/fluent/page/zoom/photo_zoom_page.dart +++ /dev/null @@ -1,286 +0,0 @@ -import 'dart:io'; - -import 'package:bot_toast/bot_toast.dart'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter/gestures.dart'; -import 'package:path/path.dart'; -import 'package:path_provider/path_provider.dart'; -import 'package:photo_view/photo_view.dart'; -import 'package:photo_view/photo_view_gallery.dart'; -import 'package:pixez/clipboard_plugin.dart'; -import 'package:pixez/fluent/component/context_menu.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/illust.dart'; -import 'package:share_plus/share_plus.dart'; - -class PhotoZoomPage extends StatefulWidget { - final int index; - final Illusts illusts; - - const PhotoZoomPage({Key? key, required this.index, required this.illusts}) - : super(key: key); - - @override - _PhotoZoomPageState createState() => _PhotoZoomPageState(); -} - -class _PhotoZoomPageState extends State { - late Illusts _illusts; - int _index = 0; - - @override - void initState() { - _loadSource = userSetting.zoomQuality == 1; - _illusts = widget.illusts; - _index = widget.index; - nowUrl = _illusts.pageCount == 1 - ? (_loadSource - ? _illusts.metaSinglePage!.originalImageUrl! - : _illusts.imageUrls.large) - : (_loadSource - ? _illusts.metaPages[_index].imageUrls!.original - : _illusts.metaPages[_index].imageUrls!.large); - - super.initState(); - initCache(); - } - - initCache() async { - var fileInfo = await pixivCacheManager.getFileFromCache(nowUrl); - if (mounted) - setState(() { - shareShow = fileInfo != null; - }); - } - - @override - void dispose() { - super.dispose(); - } - - final PhotoViewController _photoViewController = PhotoViewController(); - - @override - Widget build(BuildContext context) { - return Builder(builder: (context) { - if (_illusts.pageCount == 1) { - final url = _loadSource - ? _illusts.metaSinglePage!.originalImageUrl! - : _illusts.imageUrls.large; - return ScaffoldPage( - bottomBar: _buildBottom(context), - content: Listener( - onPointerSignal: (event) { - if (event is PointerScrollEvent) { - _photoViewController.scale = (_photoViewController.scale ?? 0) - - event.scrollDelta.dy / 1000; - } - }, - child: PhotoView( - filterQuality: FilterQuality.high, - initialScale: PhotoViewComputedScale.contained, - heroAttributes: PhotoViewHeroAttributes(tag: url), - imageProvider: PixivProvider.url(url), - loadingBuilder: (context, event) => _buildLoading(event), - controller: _photoViewController, - ), - ), - ); - } else { - return ScaffoldPage( - bottomBar: _buildBottom(context), - content: Container( - child: PhotoViewGallery.builder( - scrollPhysics: const BouncingScrollPhysics(), - pageController: PageController(initialPage: _index), - builder: (BuildContext context, int index) { - final url = _loadSource - ? _illusts.metaPages[index].imageUrls!.original - : _illusts.metaPages[index].imageUrls!.large; - return PhotoViewGalleryPageOptions( - imageProvider: PixivProvider.url(url), - initialScale: PhotoViewComputedScale.contained, - heroAttributes: PhotoViewHeroAttributes(tag: url), - filterQuality: FilterQuality.high, - ); - }, - itemCount: _illusts.metaPages.length, - onPageChanged: (index) async { - nowUrl = _loadSource - ? _illusts.metaPages[index].imageUrls!.original - : _illusts.metaPages[index].imageUrls!.large; - setState(() { - _index = index; - shareShow = false; - }); - var file = await pixivCacheManager.getFileFromCache(nowUrl); - if (file != null && mounted) - setState(() { - shareShow = true; - }); - }, - loadingBuilder: (context, event) => _buildLoading(event), - )), - ); - } - }); - } - - String nowUrl = ""; - - bool show = false; - bool shareShow = false; - bool _loadSource = false; - - Widget _buildBottom(BuildContext context) { - return Container( - child: Visibility( - visible: true, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Row( - children: [ - IconButton( - icon: Icon( - FluentIcons.picture_library, - color: Colors.white, - ), - onPressed: () {}, - ), - Text( - "${_index + 1}/${widget.illusts.pageCount}", - style: FluentTheme.of(context) - .typography - .body! - .copyWith(color: Colors.white), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - IconButton( - icon: Icon( - FluentIcons.back, - color: Colors.white, - ), - onPressed: () async { - Navigator.of(context).pop(); - }), - IconButton( - icon: Icon( - FluentIcons.copy, - color: Colors.white, - ), - onPressed: () async { - final url = ClipboardPlugin.getImageUrl(_illusts, _index); - if (url == null) return; - - ClipboardPlugin.showToast( - context, - ClipboardPlugin.copyImageFromUrl(url), - ); - }, - ), - ContextMenu( - child: IconButton( - icon: Icon( - FluentIcons.save, - color: Colors.white, - ), - onPressed: () { - if (_illusts.metaPages.isNotEmpty) - saveStore.saveImage(widget.illusts, index: _index); - else - saveStore.saveImage(widget.illusts); - }, - ), - items: [ - MenuFlyoutItem( - text: Text(I18n.of(context).save), - onPressed: () async { - if (_illusts.metaPages.isNotEmpty) - await saveStore.saveImage(widget.illusts, - index: _index); - else - await saveStore.saveImage(widget.illusts); - }, - ) - ], - ), - AnimatedOpacity( - opacity: shareShow ? 1 : 0.5, - duration: Duration(milliseconds: 500), - child: IconButton( - icon: Icon( - FluentIcons.share, - color: Colors.white, - ), - onPressed: () async { - var file = - await pixivCacheManager.getFileFromCache(nowUrl); - if (file != null) { - String targetPath = join( - (await getTemporaryDirectory()).path, - "share_cache", - basenameWithoutExtension(file.file.path) + - (nowUrl.endsWith(".png") ? ".png" : ".jpg")); - File targetFile = new File(targetPath); - if (!targetFile.existsSync()) { - targetFile.createSync(recursive: true); - } - file.file.copySync(targetPath); - Share.shareXFiles( - [XFile(targetPath)], - ); - } else { - BotToast.showText(text: "can not find image cache"); - } - }), - ), - IconButton( - icon: Icon( - !_loadSource - ? FluentIcons.picture_fill - : FluentIcons.picture, - color: Colors.white, - ), - onPressed: () { - setState(() { - _loadSource = !_loadSource; - }); - }), - ], - ), - ], - ), - ), - ); - } - - Center _buildLoading(ImageChunkEvent? event) { - double value = event == null || event.expectedTotalBytes == null - ? 0 - : event.cumulativeBytesLoaded / event.expectedTotalBytes!; - if (value == 1.0) { - Future.delayed(Duration(milliseconds: 500), () { - if (mounted) { - setState(() { - shareShow = true; - }); - } - }); - } - return Center( - child: Container( - width: 20.0, - height: 20.0, - child: ProgressRing(), - ), - ); - } -} diff --git a/lib/fluent/page/zoom/zoom_page.dart b/lib/fluent/page/zoom/zoom_page.dart deleted file mode 100644 index 316ddd0f4..000000000 --- a/lib/fluent/page/zoom/zoom_page.dart +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (C) 2020. by perol_notsf, All rights reserved - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - */ - -import 'dart:ui'; -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; - -class ZoomPage extends StatefulWidget { - final String url; - - const ZoomPage({Key? key, required this.url}) : super(key: key); - - @override - _ZoomPageState createState() => _ZoomPageState(); -} - -class _ZoomPageState extends State { - bool fabvisible = true; - - @override - Widget build(BuildContext context) { - return ScaffoldPage( - content: Center( - child: PinchZoomImage( - image: PixivImage(widget.url), - onZoomStart: () { - print('Zoom started'); - setState(() { - fabvisible = false; - }); - }, - onZoomEnd: () { - print('Zoom finished'); - setState(() { - fabvisible = true; - }); - }, - ), - ), - ); - } -} - -class PinchZoomImage extends StatefulWidget { - final Widget image; - final Color zoomedBackgroundColor; - final Function? onZoomStart; - final Function? onZoomEnd; - - PinchZoomImage({ - required this.image, - this.zoomedBackgroundColor = Colors.transparent, - this.onZoomStart, - this.onZoomEnd, - }); - - @override - _PinchZoomImageState createState() => _PinchZoomImageState(); -} - -class _PinchZoomImageState extends State { - OverlayEntry? overlayEntry; - Offset? scaleStartPosition; - Offset? origin; - int numPointers = 0; - bool zooming = false; - bool reversing = false; - GlobalKey overlayKey = GlobalKey(); - - @override - Widget build(BuildContext context) { - return Listener( - onPointerDown: (_) => numPointers++, - onPointerUp: (_) => numPointers--, - child: GestureDetector( - onScaleStart: _handleScaleStart, - onScaleUpdate: _handleScaleUpdate, - onScaleEnd: _handleScaleEnd, - child: Stack( - clipBehavior: Clip.hardEdge, - children: [ - Opacity( - opacity: zooming ? 0.0 : 1.0, - child: widget.image, - ), - Positioned( - top: 0.0, - left: 0.0, - right: 0.0, - bottom: 0.0, - child: Container( - color: - zooming ? widget.zoomedBackgroundColor : Colors.transparent, - ), - ), - ], - ), - ), - ); - } - - void _handleScaleStart(ScaleStartDetails details) { - if (overlayEntry != null || reversing || numPointers < 2) return; - setState(() { - zooming = true; - }); - if (widget.onZoomStart != null) widget.onZoomStart!(); - OverlayState overlayState = Overlay.of(context); - double width = context.size!.width; - double height = context.size!.height; - origin = (context.findRenderObject() as RenderBox) - .localToGlobal(Offset(0.0, 0.0)); - scaleStartPosition = details.focalPoint; - - overlayEntry = OverlayEntry( - maintainState: true, - builder: (BuildContext context) { - return PinchZoomOverlayImage( - key: overlayKey, - height: height, - width: width, - origin: origin!, - image: widget.image, - ); - }, - ); - - overlayState.insert(overlayEntry!); - } - - void _handleScaleUpdate(ScaleUpdateDetails details) { - if (reversing || numPointers < 2) return; - overlayKey.currentState - ?.updatePosition(origin! - (scaleStartPosition! - details.focalPoint)); - if (details.scale >= 1.0) - overlayKey.currentState?.updateScale(details.scale); - } - - void _handleScaleEnd(ScaleEndDetails details) async { - if (reversing || !zooming) return; - reversing = true; - if (widget.onZoomEnd != null) widget.onZoomEnd!(); - await overlayKey.currentState?.reverse(); - overlayEntry?.remove(); - overlayEntry = null; - origin = null; - scaleStartPosition = null; - reversing = false; - setState(() { - zooming = false; - }); - } -} - -class PinchZoomOverlayImage extends StatefulWidget { - final Key? key; - final Offset origin; - final double width; - final double height; - final Widget image; - - PinchZoomOverlayImage({ - this.key, - required this.origin, - required this.width, - required this.height, - required this.image, - }) : super(key: key); - - @override - PinchZoomOverlayImageState createState() => PinchZoomOverlayImageState(); -} - -class PinchZoomOverlayImageState extends State - with TickerProviderStateMixin { - AnimationController? reverseAnimationController; - Offset? position; - double scale = 1.0; - - @override - void initState() { - super.initState(); - this.position = widget.origin; - } - - @override - void dispose() { - reverseAnimationController?.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Stack( - children: [ - LayoutBuilder( - builder: (context, constraints) => Opacity( - opacity: ((scale - 1.0) / - ((constraints.maxHeight / widget.height) - 1.0)) - .clamp(0.0, 1.0), - child: Container( - color: Colors.black, - ), - ), - ), - Positioned( - top: position!.dy, - left: position!.dx, - width: widget.width, - height: widget.height, - child: Transform.scale( - scale: scale, - child: widget.image, - ), - ), - ], - ); - } - - void updatePosition(Offset newPosition) { - setState(() { - position = newPosition; - }); - } - - void updateScale(double newScale) { - setState(() { - scale = newScale; - }); - } - - TickerFuture reverse() { - Offset origin = widget.origin; - Offset reverseStartPosition = position!; - double reverseStartScale = scale; - - reverseAnimationController = AnimationController( - vsync: this, - duration: Duration(milliseconds: 200), - )..addListener(() { - setState(() { - position = Offset.lerp( - reverseStartPosition, - origin, - Curves.easeInOut.transform(reverseAnimationController!.value), - ); - - scale = lerpDouble( - reverseStartScale, - 1.0, - Curves.easeInOut.transform(reverseAnimationController!.value), - )!; - }); - }); - - return reverseAnimationController!.forward(from: 0.0); - } -} diff --git a/lib/fluent/platform/platform.dart b/lib/fluent/platform/platform.dart deleted file mode 100644 index 7f1c86556..000000000 --- a/lib/fluent/platform/platform.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'dart:io'; - -import 'package:fluent_ui/fluent_ui.dart'; -import 'package:flutter_acrylic/flutter_acrylic.dart'; -import 'package:pixez/fluent/platform/windows/windows.dart' as windows; - - -/// 这个函数是获取数据库位置的,当返回有值的时候将数据库存到这个地方 -Future getDBPath() async { - switch (Platform.operatingSystem) { - case "windows": - return await windows.Paths.getAppDataFolderPath(); - case "linux": - case "macos": - default: - debugPrint('Not Impliment'); - return null; - } -} - -Future getEffect() async { - switch (Platform.operatingSystem) { - case "windows": - if (await windows.Win32.isBuildOrGreater(22523)) { - return WindowEffect.tabbed; - } else if (await windows.Win32.isBuildOrGreater(22000)) { - return WindowEffect.mica; - // 亚克力效果由于存在一些问题所以先不启用 - // } else if (windows.isBuildOrGreater(17134)) { - // effect = WindowEffect.acrylic; - } - return WindowEffect.disabled; - case "linux": - case "macos": - default: - debugPrint('Not Impliment'); - return WindowEffect.disabled; - } -} diff --git a/lib/fluent/platform/windows/paths.dart b/lib/fluent/platform/windows/paths.dart deleted file mode 100644 index 09061cf65..000000000 --- a/lib/fluent/platform/windows/paths.dart +++ /dev/null @@ -1,22 +0,0 @@ - -part of 'windows.dart'; - -class Paths { - static MethodChannel channel = MethodChannel("com.perol.dev/single_instance"); - - static Future getAppDataFolderPath() async { - try { - return await channel.invokeMethod("getAppDataFolderPath"); - } catch (e) { - return null; - } - } - - static Future getPicturesFolderPath() async { - try { - return await channel.invokeMethod("getPicturesFolderPath"); - } catch (e) { - return null; - } - } -} diff --git a/lib/fluent/platform/windows/win32.dart b/lib/fluent/platform/windows/win32.dart deleted file mode 100644 index e84fcf10a..000000000 --- a/lib/fluent/platform/windows/win32.dart +++ /dev/null @@ -1,16 +0,0 @@ -part of 'windows.dart'; - -class Win32 { - static MethodChannel channel = MethodChannel("com.perol.dev/win32"); - - /// 判断系统build版本号是否大于 [build] - static Future isBuildOrGreater(int build) async { - try { - return await channel.invokeMethod("isBuildOrGreater", { - 'build': build - }); - } catch (e) { - return false; - } - } -} diff --git a/lib/fluent/platform/windows/windows.dart b/lib/fluent/platform/windows/windows.dart deleted file mode 100644 index 933854c1f..000000000 --- a/lib/fluent/platform/windows/windows.dart +++ /dev/null @@ -1,4 +0,0 @@ -import 'package:flutter/services.dart'; - -part 'win32.dart'; -part 'paths.dart'; \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index a478d64d6..13be7625b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -26,7 +26,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:pixez/constants.dart'; import 'package:pixez/er/fetcher.dart'; import 'package:pixez/er/hoster.dart'; -import 'package:pixez/fluent/fluentui.dart'; +// import 'package:pixez/fluent/fluentui.dart'; import 'package:pixez/network/onezero_client.dart'; import 'package:pixez/page/novel/history/novel_history_store.dart'; import 'package:pixez/page/splash/splash_page.dart'; @@ -67,7 +67,7 @@ main(List args) async { SingleInstancePlugin.initialize(); } - await initFluent(args); + // await initFluent(args); runApp(ProviderScope( child: MyApp(arguments: args), @@ -133,16 +133,16 @@ class _MyAppState extends State with WidgetsBindingObserver { @override Widget build(BuildContext context) { return Constants.isFluent - ? buildFluentUI(context) + ? _buildMaterial(context) : _buildMaterial(context); } Widget _buildMaterial(BuildContext context) { - SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); + // SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( - systemNavigationBarColor: Colors.transparent, - systemNavigationBarDividerColor: Colors.transparent, statusBarColor: Colors.transparent, + statusBarIconBrightness: Brightness.dark, + systemNavigationBarColor: Colors.transparent, )); final botToastBuilder = BotToastInit(); return DynamicColorBuilder( @@ -176,9 +176,9 @@ class _MyAppState extends State with WidgetsBindingObserver { home: Builder(builder: (context) { return AnnotatedRegion( value: SystemUiOverlayStyle( - systemNavigationBarColor: Colors.transparent, - systemNavigationBarDividerColor: Colors.transparent, - statusBarColor: Colors.transparent, + statusBarColor: Colors.transparent, + statusBarIconBrightness: Brightness.dark, + systemNavigationBarColor: Colors.transparent, ), child: SplashPage()); }), @@ -193,12 +193,13 @@ class _MyAppState extends State with WidgetsBindingObserver { primaryColor: lightColorScheme.primary, colorScheme: lightColorScheme, scaffoldBackgroundColor: lightColorScheme.surface, - cardColor: lightColorScheme.surfaceContainer, - dialogBackgroundColor: lightColorScheme.surfaceContainer, + // cardColor: lightColorScheme.surfaceContainer, + // dialogBackgroundColor: lightColorScheme.surfaceContainer, chipTheme: ChipThemeData( backgroundColor: lightColorScheme.surface, ), - canvasColor: lightColorScheme.surfaceContainer), + // canvasColor: lightColorScheme.surfaceContainer + ), darkTheme: ThemeData.dark().copyWith( scaffoldBackgroundColor: userSetting.isAMOLED ? Colors.black : null, diff --git a/lib/models/glance_illust_persist.dart b/lib/models/glance_illust_persist.dart index 0f6003e26..158ea81a1 100644 --- a/lib/models/glance_illust_persist.dart +++ b/lib/models/glance_illust_persist.dart @@ -39,7 +39,7 @@ extension GlanceIllustExt on Illusts { userId: user.id, pictureUrl: imageUrls.medium, originalUrl: metaSinglePage?.originalImageUrl ?? - metaPages.firstOrNull?.imageUrls?.original, + metaPages.first?.imageUrls?.original, largeUrl: imageUrls.large, title: title, userName: user.name, diff --git a/lib/network/api_client.dart b/lib/network/api_client.dart index 88f7cbaa6..db432b7bf 100644 --- a/lib/network/api_client.dart +++ b/lib/network/api_client.dart @@ -398,8 +398,8 @@ class ApiClient { DateTime? end_date, List? bookmark_num, int? search_ai_type}) async { - final bookmark_num_min = bookmark_num?.elementAtOrNull(0); - final bookmark_num_max = bookmark_num?.elementAtOrNull(1); + final bookmark_num_min = bookmark_num?.elementAt(0); + final bookmark_num_max = bookmark_num?.elementAt(1); return httpClient.get("/v1/search/illust", queryParameters: notNullMap({ "filter": Platform.isAndroid ? "for_android" : "for_ios", diff --git a/lib/page/about/contributors.dart b/lib/page/about/contributors.dart index 76d63dea9..6ac7ef6da 100644 --- a/lib/page/about/contributors.dart +++ b/lib/page/about/contributors.dart @@ -2,10 +2,10 @@ import 'dart:io'; import 'dart:math'; import 'package:bot_toast/bot_toast.dart'; -import 'package:fluent_ui/fluent_ui.dart' as fluentui; +// import 'package:fluent_ui/fluent_ui.dart' as fluentui; import 'package:flutter/material.dart' as material; import 'package:flutter/widgets.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart' as fluentui; +// import 'package:pixez/fluent/component/pixiv_image.dart' as fluentui; import 'package:pixez/component/pixiv_image.dart' as material; import 'package:pixez/constants.dart'; import 'package:pixez/main.dart'; @@ -16,27 +16,27 @@ import 'package:pixez/network/api_client.dart'; final bool _safeMode = Platform.isIOS || Constants.isGooglePlay; get _showBottomSheet { - if (Constants.isFluent) - return ({ - required BuildContext context, - required WidgetBuilder builder, - Color? backgroundColor, - double? elevation, - ShapeBorder? shape, - Clip? clipBehavior, - BoxConstraints? constraints, - bool? enableDrag, - AnimationController? transitionAnimationController, - }) => - fluentui.showDialog( - context: context, - barrierDismissible: true, - builder: (context) => Padding( - padding: EdgeInsets.all(128), - child: builder(context), - ), - ); - else + // if (Constants.isFluent) + // return ({ + // required BuildContext context, + // required WidgetBuilder builder, + // Color? backgroundColor, + // double? elevation, + // ShapeBorder? shape, + // Clip? clipBehavior, + // BoxConstraints? constraints, + // bool? enableDrag, + // AnimationController? transitionAnimationController, + // }) => + // fluentui.showDialog( + // context: context, + // barrierDismissible: true, + // builder: (context) => Padding( + // padding: EdgeInsets.all(128), + // child: builder(context), + // ), + // ); + // else return material.showBottomSheet; } @@ -70,7 +70,7 @@ List contributors = [ builder: (context) { return SafeArea( child: Constants.isFluent - ? fluentui.PixivImage(url) + ? material.PixivImage(url) : material.PixivImage(url), ); }, @@ -115,7 +115,7 @@ List contributors = [ final url = recommend.illusts[Random().nextInt(10)].imageUrls.medium; return SafeArea( child: Constants.isFluent - ? fluentui.PixivImage(url) + ? material.PixivImage(url) : material.PixivImage(url), ); }, diff --git a/lib/page/directory/directory_page.dart b/lib/page/directory/directory_page.dart index 008d42bd6..b46adc4ed 100644 --- a/lib/page/directory/directory_page.dart +++ b/lib/page/directory/directory_page.dart @@ -41,7 +41,7 @@ class _DirectoryPageState extends State { directoryStore = DirectoryStore(); super.initState(); _initMethod(); - final dispose = reaction((_) => directoryStore.checkSuccess, (value) { + final dispose = reaction((_) => directoryStore.checkSuccess, (bool value) { if (value) Navigator.of(context).pop(directoryStore.path); }); dispose(); diff --git a/lib/page/hello/android_hello_page.dart b/lib/page/hello/android_hello_page.dart index 4e6d479c0..53209affa 100644 --- a/lib/page/hello/android_hello_page.dart +++ b/lib/page/hello/android_hello_page.dart @@ -36,7 +36,7 @@ import 'package:pixez/page/hello/ranking/rank_page.dart'; import 'package:pixez/page/hello/recom/recom_spotlight_page.dart'; import 'package:pixez/page/hello/setting/setting_page.dart'; import 'package:pixez/page/login/login_page.dart'; -import 'package:pixez/page/saucenao/saucenao_page.dart'; +// import 'package:pixez/page/saucenao/saucenao_page.dart'; import 'package:pixez/page/search/search_page.dart'; import 'package:pixez/page/search/suggest/search_suggestion_page.dart'; import 'package:pixez/page/webview/saucenao_webview_page.dart'; @@ -82,12 +82,16 @@ class _AndroidHelloPageState extends State { } return LayoutBuilder(builder: (context, constraints) { final wide = constraints.maxWidth > constraints.maxHeight; - return PopScope( - onPopInvoked: (didPop) async { + return WillPopScope( + onWillPop: () async { userSetting.setAnimContainer(!userSetting.animContainer); - if (didPop) return; + if ( !userSetting.isReturnAgainToExit || + _preTime != null && + DateTime.now().difference(_preTime!) <= Duration(seconds: 2)) { + return true; + } if (!userSetting.isReturnAgainToExit) { - return; + return true; } if (_preTime == null || DateTime.now().difference(_preTime!) > Duration(seconds: 2)) { @@ -99,10 +103,8 @@ class _AndroidHelloPageState extends State { content: Text(I18n.of(context).return_again_to_exit), )); } + return false; }, - canPop: !userSetting.isReturnAgainToExit || - _preTime != null && - DateTime.now().difference(_preTime!) <= Duration(seconds: 2), child: Scaffold( body: Row(children: [ if (wide) ..._buildRail(context), @@ -286,50 +288,50 @@ class _AndroidHelloPageState extends State { saveStore.listenBehavior(stream); }); initPlatformState(); - _intentDataStreamSubscription = ReceiveSharingIntent.instance - .getMediaStream() - .listen((List value) { - for (var i in value) { - if (i.type == SharedMediaType.text) { - _showChromeLink(i.path); - continue; - } - if (i.type == SharedMediaType.image) { - if (userSetting.useSaunceNaoWebview) { - Leader.push(context, SauncenaoWebview(path: i.path)); - } else { - Leader.push( - context, - SauceNaoPage( - path: i.path, - )); - } - } - } - }, onError: (err) { - print("getIntentDataStream error: $err"); - }); - ReceiveSharingIntent.instance - .getInitialMedia() - .then((List value) { - for (var i in value) { - if (i.type == SharedMediaType.text) { - _showChromeLink(i.path); - continue; - } - if (i.type == SharedMediaType.image) { - if (userSetting.useSaunceNaoWebview) { - Leader.push(context, SauncenaoWebview(path: i.path)); - } else { - Leader.push( - context, - SauceNaoPage( - path: i.path, - )); - } - } - } - }); + // _intentDataStreamSubscription = ReceiveSharingIntent.instance + // .getMediaStream() + // .listen((List value) { + // for (var i in value) { + // if (i.type == SharedMediaType.text) { + // _showChromeLink(i.path); + // continue; + // } + // if (i.type == SharedMediaType.image) { + // if (userSetting.useSaunceNaoWebview) { + // Leader.push(context, SauncenaoWebview(path: i.path)); + // } else { + // Leader.push( + // context, + // SauceNaoPage( + // path: i.path, + // )); + // } + // } + // } + // }, onError: (err) { + // print("getIntentDataStream error: $err"); + // }); + // ReceiveSharingIntent.instance + // .getInitialMedia() + // .then((List value) { + // for (var i in value) { + // if (i.type == SharedMediaType.text) { + // _showChromeLink(i.path); + // continue; + // } + // if (i.type == SharedMediaType.image) { + // if (userSetting.useSaunceNaoWebview) { + // Leader.push(context, SauncenaoWebview(path: i.path)); + // } else { + // Leader.push( + // context, + // SauceNaoPage( + // path: i.path, + // )); + // } + // } + // } + // }); initPlatform(); } diff --git a/lib/page/hello/new/new_page.dart b/lib/page/hello/new/new_page.dart index 293e03f98..90045dc4f 100644 --- a/lib/page/hello/new/new_page.dart +++ b/lib/page/hello/new/new_page.dart @@ -76,7 +76,7 @@ class _NewPageState extends State automaticallyImplyLeading: false, title: TabBar( indicatorSize: TabBarIndicatorSize.label, - tabAlignment: TabAlignment.start, + // tabAlignment: TabAlignment.start, controller: _tabController, isScrollable: true, onTap: (i) { diff --git a/lib/page/hello/ranking/rank_page.dart b/lib/page/hello/ranking/rank_page.dart index 69fec8289..b22c0d5f2 100644 --- a/lib/page/hello/ranking/rank_page.dart +++ b/lib/page/hello/ranking/rank_page.dart @@ -113,7 +113,7 @@ class _RankPageState extends State onTap: (i) => setState(() { this.index = i; }), - tabAlignment: TabAlignment.start, + // tabAlignment: TabAlignment.start, indicatorSize: TabBarIndicatorSize.label, isScrollable: true, tabs: [ diff --git a/lib/page/hello/recom/recom_manga_page.dart b/lib/page/hello/recom/recom_manga_page.dart index 3ecc11d16..42ba181b1 100644 --- a/lib/page/hello/recom/recom_manga_page.dart +++ b/lib/page/hello/recom/recom_manga_page.dart @@ -62,7 +62,7 @@ class _RecomMangaPageState extends State { child: InkWell( onTap: () { Leader.push( - context, IllustLightingPage(id: illust.id)); + context, IllustLightingPage(id: illust!.id)); }, child: PixivImage(illust!.imageUrls.medium)), ); diff --git a/lib/page/hello/setting/data_export_page.dart b/lib/page/hello/setting/data_export_page.dart index 4c67314ae..c9cf8825d 100644 --- a/lib/page/hello/setting/data_export_page.dart +++ b/lib/page/hello/setting/data_export_page.dart @@ -83,7 +83,7 @@ class _DataExportPageState extends State { subtitle: Text(I18n.of(context).export_illust_history), onTap: () async { try { - await ref.read(historyProvider.notifier).exportData(); + // await ref.read(historyProvider.notifier).exportData(); } catch (e) { print(e); } @@ -96,7 +96,7 @@ class _DataExportPageState extends State { subtitle: Text(I18n.of(context).import_illust_history), onTap: () async { try { - await ref.read(historyProvider.notifier).importData(); + // await ref.read(historyProvider.notifier).importData(); } catch (e) { print(e); BotToast.showText(text: e.toString()); diff --git a/lib/page/hello/setting/setting_page.dart b/lib/page/hello/setting/setting_page.dart index 7d1af2dd0..3606473b3 100644 --- a/lib/page/hello/setting/setting_page.dart +++ b/lib/page/hello/setting/setting_page.dart @@ -107,7 +107,7 @@ class _SettingPageState extends State { AppBar( elevation: 0.0, automaticallyImplyLeading: false, - forceMaterialTransparency: true, + // forceMaterialTransparency: true, backgroundColor: Colors.transparent, actions: [ IconButton( diff --git a/lib/page/history/history_page.dart b/lib/page/history/history_page.dart index cbb93910b..49bb3f23c 100644 --- a/lib/page/history/history_page.dart +++ b/lib/page/history/history_page.dart @@ -81,9 +81,9 @@ class HistoryPage extends HookConsumerWidget { ); }); if (result == "OK") { - ref - .read(historyProvider.notifier) - .delete(reIllust[index].illustId); + // ref + // .read(historyProvider.notifier) + // .delete(reIllust[index].illustId); } }, child: Card( @@ -99,47 +99,48 @@ class HistoryPage extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final dataFuture = ref.watch(historyProvider); - final _textEditingController = useTextEditingController(); - useEffect(() { - Future.delayed(Duration.zero, () async { - await ref.read(historyProvider.notifier).fetch(); - }); - return null; - }, []); - return Scaffold( - appBar: AppBar( - title: TextField( - controller: _textEditingController, - onChanged: (word) { - if (word.trim().isNotEmpty) { - ref.read(historyProvider.notifier).search(word.trim()); - } else { - ref.read(historyProvider.notifier).fetch(); - } - }, - decoration: InputDecoration( - border: InputBorder.none, - hintText: I18n.of(context).search_word_hint, - )), - actions: [ - IconButton( - icon: Icon(Icons.close), - onPressed: () { - _textEditingController.clear(); - ref.read(historyProvider.notifier).fetch(); - }, - ) - ], - ), - floatingActionButton: FloatingActionButton( - child: Icon(Icons.delete), - onPressed: () { - _cleanAll(context, ref); - }, - ), - body: buildBody(dataFuture.data, ref), - ); + // final dataFuture = ref.watch(historyProvider); + // final _textEditingController = useTextEditingController(); + // useEffect(() { + // Future.delayed(Duration.zero, () async { + // await ref.read(historyProvider.notifier).fetch(); + // }); + // return null; + // }, []); + // return Scaffold( + // appBar: AppBar( + // title: TextField( + // controller: _textEditingController, + // onChanged: (word) { + // if (word.trim().isNotEmpty) { + // ref.read(historyProvider.notifier).search(word.trim()); + // } else { + // ref.read(historyProvider.notifier).fetch(); + // } + // }, + // decoration: InputDecoration( + // border: InputBorder.none, + // hintText: I18n.of(context).search_word_hint, + // )), + // actions: [ + // IconButton( + // icon: Icon(Icons.close), + // onPressed: () { + // _textEditingController.clear(); + // ref.read(historyProvider.notifier).fetch(); + // }, + // ) + // ], + // ), + // floatingActionButton: FloatingActionButton( + // child: Icon(Icons.delete), + // onPressed: () { + // _cleanAll(context, ref); + // }, + // ), + // body: buildBody(dataFuture.data, ref), + // ); + return Scaffold(); } Future _cleanAll(BuildContext context, WidgetRef ref) async { @@ -165,7 +166,7 @@ class HistoryPage extends HookConsumerWidget { ); }); if (result == "OK") { - ref.read(historyProvider.notifier).deleteAll(); + // ref.read(historyProvider.notifier).deleteAll(); } } } diff --git a/lib/page/history/history_store.dart b/lib/page/history/history_store.dart index 2a7b79ec1..05e04f193 100644 --- a/lib/page/history/history_store.dart +++ b/lib/page/history/history_store.dart @@ -7,7 +7,7 @@ import 'package:pixez/models/illust_persist.dart'; import 'package:pixez/saf_plugin.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; -part 'history_store.g.dart'; +// part 'history_store.g.dart'; part 'history_store.freezed.dart'; @freezed @@ -19,23 +19,23 @@ class HistoryState with _$HistoryState { } @riverpod -class History extends _$History { +class History { final illustPersistProvider = IllustPersistProvider(); - @override + // @override HistoryState build() { return HistoryState(data: [], word: ""); } Future fetch() async { await illustPersistProvider.open(); - final result = await illustPersistProvider.getAllAccount(); - state = state.copyWith(data: result); + // final result = await illustPersistProvider.getAllAccount(); + // state = state.copyWith(data: result); } Future search(String word) async { await illustPersistProvider.open(); - final result = await illustPersistProvider.getLikeIllusts(word); - state = state.copyWith(data: result); + // final result = await illustPersistProvider.getLikeIllusts(word); + // state = state.copyWith(data: result); } Future insert(Illusts illust) async { diff --git a/lib/page/novel/novel_rail.dart b/lib/page/novel/novel_rail.dart index e5dac2182..84a6f2f39 100644 --- a/lib/page/novel/novel_rail.dart +++ b/lib/page/novel/novel_rail.dart @@ -59,12 +59,14 @@ class _NovelRailState extends State { @override Widget build(BuildContext context) { - return PopScope( - onPopInvoked: (didPop) async { + return WillPopScope( + onWillPop: () async { userSetting.setAnimContainer(!userSetting.animContainer); - if (didPop) return; + if (!userSetting.isReturnAgainToExit || + _preTime != null && + DateTime.now().difference(_preTime!) <= Duration(seconds: 2)) return true; if (!userSetting.isReturnAgainToExit) { - return; + return true; } if (_preTime == null || DateTime.now().difference(_preTime!) > Duration(seconds: 2)) { @@ -76,10 +78,8 @@ class _NovelRailState extends State { content: Text(I18n.of(context).return_again_to_exit), )); } + return false; }, - canPop: !userSetting.isReturnAgainToExit || - _preTime != null && - DateTime.now().difference(_preTime!) <= Duration(seconds: 2), child: Scaffold( floatingActionButton: FloatingActionButton( onPressed: () { diff --git a/lib/page/novel/series/novel_series_page.dart b/lib/page/novel/series/novel_series_page.dart index 622696ae2..08d6e0313 100644 --- a/lib/page/novel/series/novel_series_page.dart +++ b/lib/page/novel/series/novel_series_page.dart @@ -61,13 +61,13 @@ class NovelSeriesNotifier extends Notifier { detail.nextUrl); state = result; refreshController.finishLoad( - IndicatorResult.success, detail.nextUrl == null); + IndicatorResult.success); } catch (e) { print(e); refreshController.finishLoad(IndicatorResult.fail); } } else { - refreshController.finishLoad(IndicatorResult.success, true); + refreshController.finishLoad(IndicatorResult.success); } } diff --git a/lib/page/novel/viewer/image_text.dart b/lib/page/novel/viewer/image_text.dart index b3410f076..29b560b10 100644 --- a/lib/page/novel/viewer/image_text.dart +++ b/lib/page/novel/viewer/image_text.dart @@ -189,8 +189,8 @@ class NovelSpansGenerator { LPrinter.d(key); String now = key.substring(flag.length, key.indexOf("]")); Iterable matches = linkRegex.allMatches(now); - final matchLink = matches.firstOrNull; - if (matchLink != null) { + if (matches != null && matches.isNotEmpty) { + final matchLink = matches.first; final link = matchLink.group(0); if (link != null) { final uri = Uri.tryParse(link); diff --git a/lib/page/novel/viewer/novel_viewer.dart b/lib/page/novel/viewer/novel_viewer.dart index bf280447f..30d148e71 100644 --- a/lib/page/novel/viewer/novel_viewer.dart +++ b/lib/page/novel/viewer/novel_viewer.dart @@ -661,7 +661,7 @@ class _NovelViewerPageState extends State { final uri = await SAFPlugin.createFile( "${_novelStore.novel!.title.trim().toLegal()}.txt", "application/txt"); - await SAFPlugin.writeUri(uri!, utf8.encode(data)); + await SAFPlugin.writeUri(uri!, Uint8List.fromList(utf8.encode(data))); BotToast.showText(text: "export success"); } else if (Platform.isIOS) { final path = await getApplicationDocumentsDirectory(); diff --git a/lib/page/picture/illust_lighting_page.dart b/lib/page/picture/illust_lighting_page.dart index f81d9414c..dd24aaa3f 100644 --- a/lib/page/picture/illust_lighting_page.dart +++ b/lib/page/picture/illust_lighting_page.dart @@ -1197,6 +1197,7 @@ class TextSelectionFix { TextSelectionControls? controls = null; switch (Theme.of(context).platform) { case TargetPlatform.android: + case TargetPlatform.ohos: case TargetPlatform.fuchsia: controls ??= materialTextSelectionControls; break; diff --git a/lib/page/saucenao/sauce_notifier.dart b/lib/page/saucenao/sauce_notifier.dart index c612c6ded..57187d280 100644 --- a/lib/page/saucenao/sauce_notifier.dart +++ b/lib/page/saucenao/sauce_notifier.dart @@ -22,18 +22,18 @@ import 'package:url_launcher/url_launcher.dart'; import 'package:image_picker_android/image_picker_android.dart'; import 'package:image_picker_platform_interface/image_picker_platform_interface.dart'; -part 'sauce_notifier.freezed.dart'; -part 'sauce_notifier.g.dart'; +// part 'sauce_notifier.freezed.dart'; +// part 'sauce_notifier.g.dart'; -@freezed -class SauceState with _$SauceState { - const factory SauceState({ - required bool notStart, - }) = _SauceState; -} +// @freezed +// class SauceState with _$SauceState { +// const factory SauceState({ +// required bool notStart, +// }) = _SauceState; +// } @riverpod -class Sauce extends _$Sauce { +class Sauce { static String host = "saucenao.com"; Dio dio = Dio(BaseOptions( baseUrl: "https://saucenao.com", headers: {HttpHeaders.hostHeader: host})); @@ -51,10 +51,9 @@ class Sauce extends _$Sauce { await _streamController.close(); } - @override - SauceState build() { - return SauceState(notStart: true); - } + // SauceState build() { + // return SauceState(notStart: true); + // } Future findImage( {BuildContext? context, String? path, bool retry = false}) async { @@ -108,7 +107,7 @@ class Sauce extends _$Sauce { await pre.setBool("photo_picker_type_selected", true); } } - state = state.copyWith(notStart: false); + // state = state.copyWith(notStart: false); results.clear(); final picker = ImagePicker(); final ImagePickerPlatform imagePickerImplementation = diff --git a/lib/page/search/result_illust_list.dart b/lib/page/search/result_illust_list.dart index cdeb61d19..f96ee4965 100644 --- a/lib/page/search/result_illust_list.dart +++ b/lib/page/search/result_illust_list.dart @@ -359,12 +359,12 @@ class _ResultIllustListState extends State { }, ); } else { - final minStr = value.elementAtOrNull(1) == null - ? ">${value.elementAtOrNull(0) ?? ''}" - : "${value.elementAtOrNull(0) ?? ''}"; - final maxStr = value.elementAtOrNull(1) == null + final minStr = value.elementAt(1) == null + ? ">${value.elementAt(0) ?? ''}" + : "${value.elementAt(0) ?? ''}"; + final maxStr = value.elementAt(1) == null ? "" - : "〜${value.elementAtOrNull(1)}"; + : "〜${value.elementAt(1)}"; return PopupMenuItem( value: value, diff --git a/lib/page/search/suggest/search_suggestion_page.dart b/lib/page/search/suggest/search_suggestion_page.dart index a1de8d2e4..63768b2b5 100644 --- a/lib/page/search/suggest/search_suggestion_page.dart +++ b/lib/page/search/suggest/search_suggestion_page.dart @@ -20,7 +20,7 @@ import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:pixez/er/leader.dart'; import 'package:pixez/i18n.dart'; import 'package:pixez/page/picture/illust_lighting_page.dart'; -import 'package:pixez/page/saucenao/sauce_store.dart'; +// import 'package:pixez/page/saucenao/sauce_store.dart'; import 'package:pixez/page/search/result_page.dart'; import 'package:pixez/page/search/suggest/suggestion_store.dart'; import 'package:pixez/page/soup/soup_page.dart'; @@ -38,7 +38,7 @@ class SearchSuggestionPage extends StatefulWidget { class _SearchSuggestionPageState extends State { late TextEditingController _filter; late SuggestionStore _suggestionStore; - late SauceStore _sauceStore; + // late SauceStore _sauceStore; FocusNode focusNode = FocusNode(); final tagGroup = []; bool idV = false; @@ -47,19 +47,19 @@ class _SearchSuggestionPageState extends State { void initState() { idV = widget.preword != null && int.tryParse(widget.preword!) != null; _suggestionStore = SuggestionStore(); - _sauceStore = SauceStore(); - _sauceStore.observableStream.listen((event) { - if (event != null && _sauceStore.results.isNotEmpty) { - Navigator.of(context).push(MaterialPageRoute( - builder: (context) => PageView( - children: _sauceStore.results - .map((element) => IllustLightingPage(id: element)) - .toList(), - ))); - } else { - BotToast.showText(text: "0 result"); - } - }); + // _sauceStore = SauceStore(); + // _sauceStore.observableStream.listen((event) { + // if (event != null && _sauceStore.results.isNotEmpty) { + // Navigator.of(context).push(MaterialPageRoute( + // builder: (context) => PageView( + // children: _sauceStore.results + // .map((element) => IllustLightingPage(id: element)) + // .toList(), + // ))); + // } else { + // BotToast.showText(text: "0 result"); + // } + // }); var query = widget.preword ?? ''; _filter = TextEditingController(text: query); var tags = query @@ -73,7 +73,7 @@ class _SearchSuggestionPageState extends State { @override void dispose() { _filter.dispose(); - _sauceStore.dispose(); + // _sauceStore.dispose(); super.dispose(); } @@ -84,7 +84,7 @@ class _SearchSuggestionPageState extends State { appBar: _buildAppBar(context), floatingActionButton: FloatingActionButton( onPressed: () async { - _sauceStore.findImage(context: context); + // _sauceStore.findImage(context: context); }, child: Icon(Icons.add_photo_alternate), ), diff --git a/lib/page/user/bookmark/bookmark_page.dart b/lib/page/user/bookmark/bookmark_page.dart index 3679d977f..55dafae1e 100644 --- a/lib/page/user/bookmark/bookmark_page.dart +++ b/lib/page/user/bookmark/bookmark_page.dart @@ -135,7 +135,7 @@ class _BookmarkPageState extends State { if (kDebugMode) Padding( padding: const EdgeInsets.only(left: 8.0), - child: IconButton.filled( + child: IconButton( onPressed: () { Leader.push(context, RiverPage()); }, diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 4262a3228..d68950129 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -6,6 +6,8 @@ import FlutterMacOS import Foundation import audio_session +import battery_plus +import connectivity_plus import device_info_plus import dynamic_color import file_selector_macos @@ -13,6 +15,7 @@ import flutter_inappwebview_macos import in_app_purchase_storekit import just_audio import macos_window_utils +import network_info_plus import package_info_plus import path_provider_foundation import screen_retriever @@ -20,12 +23,13 @@ import share_plus import shared_preferences_foundation import sqflite import url_launcher_macos -import video_player_avfoundation import wakelock_plus import window_manager func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin")) + BatteryPlusMacosPlugin.register(with: registry.registrar(forPlugin: "BatteryPlusMacosPlugin")) + ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) @@ -33,6 +37,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { InAppPurchasePlugin.register(with: registry.registrar(forPlugin: "InAppPurchasePlugin")) JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin")) MacOSWindowUtilsPlugin.register(with: registry.registrar(forPlugin: "MacOSWindowUtilsPlugin")) + NetworkInfoPlusPlugin.register(with: registry.registrar(forPlugin: "NetworkInfoPlusPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin")) @@ -40,7 +45,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) - FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin")) WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin")) WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin")) } diff --git a/ohos/AppScope/app.json5 b/ohos/AppScope/app.json5 index 6d3ad7c66..bba183577 100644 --- a/ohos/AppScope/app.json5 +++ b/ohos/AppScope/app.json5 @@ -2,9 +2,9 @@ "app": { "bundleName": "com.perol.pixez_flutter", "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", + "versionCode": 380, + "versionName": "1.9.48", "icon": "$media:app_icon", "label": "$string:app_name" } -} +} \ No newline at end of file diff --git a/ohos/AppScope/resources/base/element/string.json b/ohos/AppScope/resources/base/element/string.json index ee34a956e..c0e0a4c42 100644 --- a/ohos/AppScope/resources/base/element/string.json +++ b/ohos/AppScope/resources/base/element/string.json @@ -2,7 +2,7 @@ "string": [ { "name": "app_name", - "value": "pixez_flutter" + "value": "PixEz" } ] } diff --git a/ohos/AppScope/resources/base/media/app_icon.png b/ohos/AppScope/resources/base/media/app_icon.png index ce307a882..ca1bf0972 100644 Binary files a/ohos/AppScope/resources/base/media/app_icon.png and b/ohos/AppScope/resources/base/media/app_icon.png differ diff --git a/ohos/build-profile.json5 b/ohos/build-profile.json5 index 0d8b167e6..f670bd7f6 100644 --- a/ohos/build-profile.json5 +++ b/ohos/build-profile.json5 @@ -1,27 +1,26 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - { "app": { - "signingConfigs": [], + "signingConfigs": [ + { + "name": "default", + "type": "HarmonyOS", + "material": { + "certpath": "C:\\Users\\handw\\.ohos\\config\\default_ohos_s9mv0aV01W64y1jZx5eupfPE3tJqLgxW2rFvB7zXfzQ=.cer", + "storePassword": "0000001B7AEA072C01938760991E40982656DA769EC8FF5273EAE474D5D60FECA3D001B04BDA7D88914ACB", + "keyAlias": "debugKey", + "keyPassword": "0000001BA85C78096A0C0425FA45439105EB67C2EB4AEB418463FE16FDA1AC78A93DF320495331F5521C33", + "profile": "C:\\Users\\handw\\.ohos\\config\\default_ohos_s9mv0aV01W64y1jZx5eupfPE3tJqLgxW2rFvB7zXfzQ=.p7b", + "signAlg": "SHA256withECDSA", + "storeFile": "C:\\Users\\handw\\.ohos\\config\\default_ohos_s9mv0aV01W64y1jZx5eupfPE3tJqLgxW2rFvB7zXfzQ=.p12" + } + } + ], "products": [ { "name": "default", "signingConfig": "default", "compatibleSdkVersion": "5.0.0(12)", - "runtimeOS": "HarmonyOS", + "runtimeOS": "HarmonyOS" } ] }, diff --git a/ohos/entry/oh-package.json5 b/ohos/entry/oh-package.json5 index dabaee131..0e9de8734 100644 --- a/ohos/entry/oh-package.json5 +++ b/ohos/entry/oh-package.json5 @@ -1,18 +1,3 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - { "name": "entry", "version": "1.0.0", @@ -21,6 +6,16 @@ "author": "", "license": "", "dependencies": { - }, -} - + "flutter_inappwebview_ohos": "file:../har/flutter_inappwebview_ohos.har", + "file_selector_ohos": "file:../har/file_selector_ohos.har", + "image_picker_ohos": "file:../har/image_picker_ohos.har", + "path_provider_ohos": "file:../har/path_provider_ohos.har", + "shared_preferences_ohos": "file:../har/shared_preferences_ohos.har", + "url_launcher_ohos": "file:../har/url_launcher_ohos.har", + "permission_handler_ohos": "file:../har/permission_handler_ohos.har", + "connectivity_plus": "file:../har/connectivity_plus.har", + "device_info_plus": "file:../har/device_info_plus.har", + "package_info_plus": "file:../har/package_info_plus.har", + "share_plus": "file:../har/share_plus.har" + } +} \ No newline at end of file diff --git a/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets b/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets new file mode 100644 index 000000000..49323dcbb --- /dev/null +++ b/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets @@ -0,0 +1,46 @@ +import { FlutterEngine, Log } from '@ohos/flutter_ohos'; +import ConnectivityPlugin from 'connectivity_plus'; +import DeviceInfoPlusOhosPlugin from 'device_info_plus'; +import FileSelectorOhosPlugin from 'file_selector_ohos'; +import InAppWebViewFlutterPlugin from 'flutter_inappwebview_ohos'; +import ImagePickerPlugin from 'image_picker_ohos'; +import PackageInfoPlugin from 'package_info_plus'; +import PathProviderPlugin from 'path_provider_ohos'; +import PermissionHandlerPlugin from 'permission_handler_ohos'; +import SharePlusOhosPlugin from 'share_plus'; +import SharedPreferencesPlugin from 'shared_preferences_ohos'; +import UrlLauncherPlugin from 'url_launcher_ohos'; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Ohos platform. + */ + +const TAG = "GeneratedPluginRegistrant"; + +export class GeneratedPluginRegistrant { + + static registerWith(flutterEngine: FlutterEngine) { + try { + flutterEngine.getPlugins()?.add(new ConnectivityPlugin()); + flutterEngine.getPlugins()?.add(new DeviceInfoPlusOhosPlugin()); + flutterEngine.getPlugins()?.add(new FileSelectorOhosPlugin()); + flutterEngine.getPlugins()?.add(new InAppWebViewFlutterPlugin()); + flutterEngine.getPlugins()?.add(new ImagePickerPlugin()); + flutterEngine.getPlugins()?.add(new PackageInfoPlugin()); + flutterEngine.getPlugins()?.add(new PathProviderPlugin()); + flutterEngine.getPlugins()?.add(new PermissionHandlerPlugin()); + flutterEngine.getPlugins()?.add(new SharePlusOhosPlugin()); + flutterEngine.getPlugins()?.add(new SharedPreferencesPlugin()); + flutterEngine.getPlugins()?.add(new UrlLauncherPlugin()); + } catch (e) { + Log.e( + TAG, + "Tried to register plugins with FlutterEngine (" + + flutterEngine + + ") failed."); + Log.e(TAG, "Received exception while registering", e); + } + } +} diff --git a/ohos/entry/src/main/resources/base/media/icon.png b/ohos/entry/src/main/resources/base/media/icon.png index ce307a882..ca1bf0972 100644 Binary files a/ohos/entry/src/main/resources/base/media/icon.png and b/ohos/entry/src/main/resources/base/media/icon.png differ diff --git a/ohos/entry/src/main/resources/en_US/element/string.json b/ohos/entry/src/main/resources/en_US/element/string.json index 86f2953b2..81d47e54d 100644 --- a/ohos/entry/src/main/resources/en_US/element/string.json +++ b/ohos/entry/src/main/resources/en_US/element/string.json @@ -10,7 +10,7 @@ }, { "name": "EntryAbility_label", - "value": "pixez_flutter" + "value": "PixEz" } ] } \ No newline at end of file diff --git a/ohos/entry/src/main/resources/zh_CN/element/string.json b/ohos/entry/src/main/resources/zh_CN/element/string.json index c2f5d4119..1ac717ed8 100644 --- a/ohos/entry/src/main/resources/zh_CN/element/string.json +++ b/ohos/entry/src/main/resources/zh_CN/element/string.json @@ -10,7 +10,7 @@ }, { "name": "EntryAbility_label", - "value": "pixez_flutter" + "value": "PixEz" } ] } \ No newline at end of file diff --git a/ohos/oh-package.json5 b/ohos/oh-package.json5 index 849cdfda2..f9ceae8b9 100644 --- a/ohos/oh-package.json5 +++ b/ohos/oh-package.json5 @@ -1,18 +1,3 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - { "modelVersion": "5.0.0", "name": "pixez_flutter", @@ -28,6 +13,18 @@ "@ohos/hypium": "1.0.6" }, "overrides": { - "@ohos/flutter_ohos": "file:./har/flutter.har" + "@ohos/flutter_ohos": "file:./har/flutter.har", + "flutter_inappwebview_ohos": "file:./har/flutter_inappwebview_ohos.har", + "file_selector_ohos": "file:./har/file_selector_ohos.har", + "image_picker_ohos": "file:./har/image_picker_ohos.har", + "path_provider_ohos": "file:./har/path_provider_ohos.har", + "shared_preferences_ohos": "file:./har/shared_preferences_ohos.har", + "url_launcher_ohos": "file:./har/url_launcher_ohos.har", + "permission_handler_ohos": "file:./har/permission_handler_ohos.har", + "connectivity_plus": "file:./har/connectivity_plus.har", + "device_info_plus": "file:./har/device_info_plus.har", + "package_info_plus": "file:./har/package_info_plus.har", + "share_plus": "file:./har/share_plus.har", + "@ohos/flutter_module": "file:./entry" } -} +} \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index 743fafd29..25e16965d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,69 +5,64 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834 - url: "https://pub.dev" + sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a + url: "https://pub.flutter-io.cn" source: hosted - version: "72.0.0" - _macros: - dependency: transitive - description: dart - source: sdk - version: "0.3.2" + version: "61.0.0" analyzer: dependency: "direct dev" description: name: analyzer - sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139 - url: "https://pub.dev" + sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 + url: "https://pub.flutter-io.cn" source: hosted - version: "6.7.0" + version: "5.13.0" analyzer_plugin: dependency: transitive description: name: analyzer_plugin - sha256: "9661b30b13a685efaee9f02e5d01ed9f2b423bd889d28a304d02d704aee69161" - url: "https://pub.dev" + sha256: c1d5f167683de03d5ab6c3b53fc9aeefc5d59476e7810ba7bbddff50c6f4392d + url: "https://pub.flutter-io.cn" source: hosted - version: "0.11.3" + version: "0.11.2" animations: dependency: "direct main" description: name: animations - sha256: d3d6dcfb218225bbe68e87ccf6378bbb2e32a94900722c5f81611dad089911cb - url: "https://pub.dev" + sha256: ef57563eed3620bd5d75ad96189846aca1e033c0c45fc9a7d26e80ab02b88a70 + url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.11" + version: "2.0.8" archive: dependency: "direct main" description: name: archive - sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d - url: "https://pub.dev" + sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.6.1" + version: "3.4.10" args: dependency: transitive description: name: args - sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" - url: "https://pub.dev" + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.flutter-io.cn" source: hosted - version: "2.5.0" + version: "2.4.2" async: dependency: transitive description: name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + url: "https://pub.flutter-io.cn" source: hosted - version: "2.11.0" + version: "2.10.0" audio_session: dependency: transitive description: name: audio_session sha256: "343e83bc7809fbda2591a49e525d6b63213ade10c76f15813be9aed6657b3261" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.21" auto_animated: @@ -75,23 +70,40 @@ packages: description: name: auto_animated sha256: f62311033d043d2709c25444551debdfd08649138c2923b0298d776792291149 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.0" badges: dependency: "direct main" description: name: badges - sha256: a7b6bbd60dce418df0db3058b53f9d083c22cdb5132a052145dc267494df0b84 - url: "https://pub.dev" + sha256: "6e7f3ec561ec08f47f912cfe349d4a1707afdc8dda271e17b046aa6d42c89e77" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.1.2" + version: "3.1.1" + battery_plus: + dependency: "direct overridden" + description: + path: "packages/battery_plus/battery_plus" + ref: HEAD + resolved-ref: "452bfb40465722552f31cf78cde60f99cc691e36" + url: "https://gitee.com/openharmony-sig/flutter_plus_plugins.git" + source: git + version: "4.1.0" + battery_plus_platform_interface: + dependency: transitive + description: + name: battery_plus_platform_interface + sha256: "19fd8418a81aeb2dea8fb7026b1fdf56b6c6d319baf8d703fa0d13c1d5c7ba2f" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.2" boolean_selector: dependency: transitive description: name: boolean_selector sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" bot_toast: @@ -99,167 +111,184 @@ packages: description: name: bot_toast sha256: "6b93030a99a98335b8827ecd83021e92e885ffc61d261d3825ffdecdd17f3bdf" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "4.1.3" build: dependency: transitive description: name: build - sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" - url: "https://pub.dev" + sha256: "3fbda25365741f8251b39f3917fb3c8e286a96fd068a5a242e11c2012d495777" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.1" + version: "2.3.1" build_config: dependency: transitive description: name: build_config sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.1" build_daemon: dependency: transitive description: name: build_daemon - sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" - url: "https://pub.dev" + sha256: "757153e5d9cd88253cb13f28c2fb55a537dc31fefd98137549895b5beb7c6169" + url: "https://pub.flutter-io.cn" source: hosted - version: "4.0.2" + version: "3.1.1" build_resolvers: dependency: transitive description: name: build_resolvers - sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" - url: "https://pub.dev" + sha256: "0713a05b0386bd97f9e63e78108805a4feca5898a4b821d6610857f10c91e975" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.2" + version: "2.4.0" build_runner: dependency: "direct dev" description: name: build_runner - sha256: dd09dd4e2b078992f42aac7f1a622f01882a8492fef08486b27ddde929c19f04 - url: "https://pub.dev" + sha256: b0a8a7b8a76c493e85f1b84bffa0588859a06197863dba8c9036b15581fd9727 + url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.12" + version: "2.3.3" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 - url: "https://pub.dev" + sha256: "0671ad4162ed510b70d0eb4ad6354c249f8429cab4ae7a4cec86bbc2886eb76e" + url: "https://pub.flutter-io.cn" source: hosted - version: "7.3.2" + version: "7.2.7+1" built_collection: dependency: transitive description: name: built_collection sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "5.1.1" built_value: dependency: transitive description: name: built_value - sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb - url: "https://pub.dev" + sha256: "69acb7007eb2a31dc901512bfe0f7b767168be34cb734835d54c070bfa74c1b2" + url: "https://pub.flutter-io.cn" source: hosted - version: "8.9.2" + version: "8.8.0" cached_network_image: dependency: "direct main" description: name: cached_network_image - sha256: "7c1183e361e5c8b0a0f21a28401eecdbde252441106a9816400dd4c2b2424916" - url: "https://pub.dev" + sha256: fd3d0dc1d451f9a252b32d95d3f0c3c487bc41a75eba2e6097cb0b9c71491b15 + url: "https://pub.flutter-io.cn" source: hosted - version: "3.4.1" + version: "3.2.3" cached_network_image_platform_interface: dependency: transitive description: name: cached_network_image_platform_interface - sha256: "35814b016e37fbdc91f7ae18c8caf49ba5c88501813f73ce8a07027a395e2829" - url: "https://pub.dev" + sha256: bb2b8403b4ccdc60ef5f25c70dead1f3d32d24b9d6117cfc087f496b178594a7 + url: "https://pub.flutter-io.cn" source: hosted - version: "4.1.1" + version: "2.0.0" cached_network_image_web: dependency: transitive description: name: cached_network_image_web - sha256: "980842f4e8e2535b8dbd3d5ca0b1f0ba66bf61d14cc3a17a9b4788a3685ba062" - url: "https://pub.dev" + sha256: b8eb814ebfcb4dea049680f8c1ffb2df399e4d03bf7a352c775e26fa06e02fa0 + url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.1" + version: "1.0.2" characters: dependency: transitive description: name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" - url: "https://pub.dev" + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0" + version: "1.2.1" checked_yaml: dependency: transitive description: name: checked_yaml sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.3" chewie: dependency: transitive description: name: chewie - sha256: "2243e41e79e865d426d9dd9c1a9624aa33c4ad11de2d0cd680f826e2cd30e879" - url: "https://pub.dev" + sha256: "8bc4ac4cf3f316e50a25958c0f5eb9bb12cf7e8308bb1d74a43b230da2cfc144" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.3" + version: "1.7.5" ci: dependency: transitive description: name: ci sha256: "145d095ce05cddac4d797a158bc4cf3b6016d1fe63d8c3d2fbd7212590adca13" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.0" cli_util: dependency: transitive description: name: cli_util - sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 - url: "https://pub.dev" + sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7 + url: "https://pub.flutter-io.cn" source: hosted - version: "0.4.1" + version: "0.4.0" clock: dependency: transitive description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.1" code_builder: dependency: transitive description: name: code_builder - sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 - url: "https://pub.dev" + sha256: "1be9be30396d7e4c0db42c35ea6ccd7cc6a1e19916b5dc64d6ac216b5544d677" + url: "https://pub.flutter-io.cn" source: hosted - version: "4.10.0" + version: "4.7.0" collection: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a - url: "https://pub.dev" + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + url: "https://pub.flutter-io.cn" source: hosted - version: "1.18.0" + version: "1.17.0" + connectivity_plus: + dependency: "direct overridden" + description: + path: "packages/connectivity_plus/connectivity_plus" + ref: HEAD + resolved-ref: "452bfb40465722552f31cf78cde60f99cc691e36" + url: "https://gitee.com/openharmony-sig/flutter_plus_plugins.git" + source: git + version: "5.0.1" + connectivity_plus_platform_interface: + dependency: transitive + description: + name: connectivity_plus_platform_interface + sha256: cf1d1c28f4416f8c654d7dc3cd638ec586076255d407cef3ddbdaf178272a71a + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.4" console: dependency: transitive description: name: console sha256: e04e7824384c5b39389acdd6dc7d33f3efe6b232f6f16d7626f194f6a01ad69a - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "4.1.0" convert: @@ -267,144 +296,128 @@ packages: description: name: convert sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.1" cross_file: dependency: transitive description: name: cross_file - sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" - url: "https://pub.dev" + sha256: "445db18de832dba8d851e287aff8ccf169bed30d2e94243cb54c7d2f1ed2142c" + url: "https://pub.flutter-io.cn" source: hosted - version: "0.3.4+2" + version: "0.3.3+6" crypto: dependency: "direct main" description: name: crypto - sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 - url: "https://pub.dev" + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.flutter-io.cn" source: hosted - version: "3.0.5" + version: "3.0.3" csslib: dependency: transitive description: name: csslib sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" cupertino_icons: dependency: transitive description: name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.dev" + sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d + url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.8" + version: "1.0.6" custom_lint: dependency: "direct dev" description: name: custom_lint - sha256: "4939d89e580c36215e48a7de8fd92f22c79dcc3eb11fda84f3402b3b45aec663" - url: "https://pub.dev" + sha256: b09a939c3bb062fdf072aa4c8eb5447231338854c4fefb23e4c9f7cef41cb3ff + url: "https://pub.flutter-io.cn" source: hosted - version: "0.6.5" - custom_lint_builder: - dependency: transitive - description: - name: custom_lint_builder - sha256: d9e5bb63ed52c1d006f5a1828992ba6de124c27a531e8fba0a31afffa81621b3 - url: "https://pub.dev" - source: hosted - version: "0.6.5" - custom_lint_core: - dependency: transitive - description: - name: custom_lint_core - sha256: "4ddbbdaa774265de44c97054dcec058a83d9081d071785ece601e348c18c267d" - url: "https://pub.dev" - source: hosted - version: "0.6.5" + version: "0.5.0" dart_style: dependency: transitive description: name: dart_style - sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9" - url: "https://pub.dev" + sha256: "1efa911ca7086affd35f463ca2fc1799584fb6aa89883cf0af8e3664d6a02d55" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.3.6" + version: "2.3.2" dbus: dependency: transitive description: name: dbus sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.7.10" device_info_plus: dependency: "direct main" description: - name: device_info_plus - sha256: a7fd703482b391a87d60b6061d04dfdeab07826b96f9abd8f5ed98068acc0074 - url: "https://pub.dev" - source: hosted - version: "10.1.2" + path: "packages/device_info_plus/device_info_plus" + ref: HEAD + resolved-ref: "452bfb40465722552f31cf78cde60f99cc691e36" + url: "https://gitee.com/openharmony-sig/flutter_plus_plugins.git" + source: git + version: "9.1.0" device_info_plus_platform_interface: dependency: transitive description: name: device_info_plus_platform_interface sha256: "282d3cf731045a2feb66abfe61bbc40870ae50a3ed10a4d3d217556c35c8c2ba" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "7.0.1" dio: dependency: "direct main" description: name: dio - sha256: "0dfb6b6a1979dac1c1245e17cef824d7b452ea29bd33d3467269f9bef3715fb0" - url: "https://pub.dev" + sha256: "5598aa796bbf4699afd5c67c0f5f6e2ed542afc956884b9cd58c306966efc260" + url: "https://pub.flutter-io.cn" source: hosted - version: "5.6.0" + version: "5.7.0" dio_cache_interceptor: dependency: "direct main" description: name: dio_cache_interceptor sha256: fb7905c0d12075d8786a6b63bffd64ae062d053f682cfaf28d145a2686507308 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.5.0" dio_web_adapter: dependency: transitive description: name: dio_web_adapter - sha256: "33259a9276d6cea88774a0000cfae0d861003497755969c92faa223108620dc8" - url: "https://pub.dev" + sha256: "36c5b2d79eb17cdae41e974b7a8284fec631651d2a6f39a8a2ff22327e90aeac" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.0" + version: "1.0.1" dynamic_color: dependency: "direct main" description: - path: "packages/dynamic_color" - ref: main - resolved-ref: "78667e1513de5cfd73b81ee29fe319de4eac5d85" - url: "https://github.com/hasali19/material-foundation-flutter-packages.git" - source: git + name: dynamic_color + sha256: eae98052fa6e2826bdac3dd2e921c6ce2903be15c6b7f8b6d8a5d49b5086298d + url: "https://pub.flutter-io.cn" + source: hosted version: "1.7.0" easy_refresh: dependency: "direct main" description: name: easy_refresh - sha256: "486e30abfcaae66c0f2c2798a10de2298eb9dc5e0bb7e1dba9328308968cae0c" - url: "https://pub.dev" + sha256: "241f92a59f5e78c6a95ff1e046dc739262d522164990426314563a43d8d7ad9c" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.4.0" + version: "3.3.0" extended_list_library: dependency: transitive description: name: extended_list_library sha256: cb424a04464e89bd6737f9ae025029bd8e913c7bf37101ad10c2defe0238d842 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0" fake_async: @@ -412,73 +425,107 @@ packages: description: name: fake_async sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.1" ffi: dependency: transitive description: name: ffi - sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" - url: "https://pub.dev" + sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99 + url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.3" + version: "2.0.2" file: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" - url: "https://pub.dev" + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.1.4" + file_selector: + dependency: "direct overridden" + description: + path: "packages/file_selector/file_selector" + ref: HEAD + resolved-ref: "67a2fe8b47eb5eb845aa320e08c3c51390033c83" + url: "https://gitee.com/openharmony-sig/flutter_packages.git" + source: git + version: "1.0.0" + file_selector_android: + dependency: transitive + description: + name: file_selector_android + sha256: b7556052dbcc25ef88f6eba45ab98aa5600382af8dfdabc9d644a93d97b7be7f + url: "https://pub.flutter-io.cn" source: hosted - version: "7.0.0" + version: "0.5.0+4" + file_selector_ios: + dependency: transitive + description: + name: file_selector_ios + sha256: "2f48db7e338b2255101c35c604b7ca5ab588dce032db7fc418a2fe5f28da63f8" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.5.1+7" file_selector_linux: dependency: transitive description: name: file_selector_linux sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.9.2+1" file_selector_macos: dependency: transitive description: name: file_selector_macos - sha256: f42eacb83b318e183b1ae24eead1373ab1334084404c8c16e0354f9a3e55d385 - url: "https://pub.dev" + sha256: b15c3da8bd4908b9918111fa486903f5808e388b8d1c559949f584725a6594d6 + url: "https://pub.flutter-io.cn" source: hosted - version: "0.9.4" + version: "0.9.3+3" + file_selector_ohos: + dependency: transitive + description: + path: "packages/file_selector/file_selector_ohos" + ref: HEAD + resolved-ref: "67a2fe8b47eb5eb845aa320e08c3c51390033c83" + url: "https://gitee.com/openharmony-sig/flutter_packages.git" + source: git + version: "0.5.0+2" file_selector_platform_interface: dependency: transitive description: name: file_selector_platform_interface - sha256: a3994c26f10378a039faa11de174d7b78eb8f79e4dd0af2a451410c1a5c3f66b - url: "https://pub.dev" + sha256: "0aa47a725c346825a2bd396343ce63ac00bda6eff2fbc43eabe99737dede8262" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.6.1" + file_selector_web: + dependency: transitive + description: + name: file_selector_web + sha256: dc6622c4d66cb1bee623ddcc029036603c6cc45c85e4a775bb06008d61c809c1 + url: "https://pub.flutter-io.cn" source: hosted - version: "2.6.2" + version: "0.9.2+1" file_selector_windows: dependency: transitive description: name: file_selector_windows - sha256: "2ad726953f6e8affbc4df8dc78b77c3b4a060967a291e528ef72ae846c60fb69" - url: "https://pub.dev" + sha256: d3547240c20cabf205c7c7f01a50ecdbc413755814d6677f3cb366f04abcead0 + url: "https://pub.flutter-io.cn" source: hosted - version: "0.9.3+2" + version: "0.9.3+1" fixnum: dependency: transitive description: name: fixnum sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" - fluent_ui: - dependency: "direct main" - description: - name: fluent_ui - sha256: ae97c15cbf41594e31d9582a359b5a725cb66753bef73ed845ba534d3c7ec053 - url: "https://pub.dev" - source: hosted - version: "4.9.1" flutter: dependency: "direct main" description: flutter @@ -489,89 +536,112 @@ packages: description: name: flutter_acrylic sha256: b3996dbde5abf5823cc9ead4cf2e5267c3181f15585fe47ce4dc4472e7ec827a - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.4" + flutter_blurhash: + dependency: transitive + description: + name: flutter_blurhash + sha256: "05001537bd3fac7644fa6558b09ec8c0a3f2eba78c0765f88912882b1331a5c6" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.7.0" flutter_cache_manager: dependency: "direct main" description: name: flutter_cache_manager - sha256: "400b6592f16a4409a7f2bb929a9a7e38c72cceb8ffb99ee57bbf2cb2cecf8386" - url: "https://pub.dev" + sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.4.1" + version: "3.3.1" flutter_displaymode: dependency: "direct main" description: name: flutter_displaymode sha256: "42c5e9abd13d28ed74f701b60529d7f8416947e58256e6659c5550db719c57ef" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.6.0" flutter_hooks: dependency: "direct main" description: name: flutter_hooks - sha256: cde36b12f7188c85286fba9b38cc5a902e7279f36dd676967106c041dc9dde70 - url: "https://pub.dev" + sha256: "291fa38c0895edd448d936bd819d29096fd75f921d9b8a7d2bfd110ff3fa4f8a" + url: "https://pub.flutter-io.cn" source: hosted - version: "0.20.5" + version: "0.18.3" flutter_inappwebview: dependency: "direct main" description: - name: flutter_inappwebview - sha256: "3e9a443a18ecef966fb930c3a76ca5ab6a7aafc0c7b5e14a4a850cf107b09959" - url: "https://pub.dev" - source: hosted + path: flutter_inappwebview + ref: HEAD + resolved-ref: c5ab0fff29b516978dbd4328dbf637e999e0db61 + url: "https://gitee.com/openharmony-sig/flutter_inappwebview.git" + source: git version: "6.0.0" flutter_inappwebview_android: dependency: transitive description: - name: flutter_inappwebview_android - sha256: d247f6ed417f1f8c364612fa05a2ecba7f775c8d0c044c1d3b9ee33a6515c421 - url: "https://pub.dev" - source: hosted - version: "1.0.13" + path: flutter_inappwebview_android + ref: HEAD + resolved-ref: c5ab0fff29b516978dbd4328dbf637e999e0db61 + url: "https://gitee.com/openharmony-sig/flutter_inappwebview.git" + source: git + version: "1.0.12" flutter_inappwebview_internal_annotations: dependency: transitive description: - name: flutter_inappwebview_internal_annotations - sha256: "5f80fd30e208ddded7dbbcd0d569e7995f9f63d45ea3f548d8dd4c0b473fb4c8" - url: "https://pub.dev" - source: hosted + path: "dev_packages/flutter_inappwebview_internal_annotations" + ref: HEAD + resolved-ref: c5ab0fff29b516978dbd4328dbf637e999e0db61 + url: "https://gitee.com/openharmony-sig/flutter_inappwebview.git" + source: git version: "1.1.1" flutter_inappwebview_ios: - dependency: "direct overridden" + dependency: transitive description: path: flutter_inappwebview_ios - ref: master - resolved-ref: "27fd339172572fe1b16cdcdae235b2a88f432e3c" - url: "https://github.com/andychucs/flutter_inappwebview.git" + ref: HEAD + resolved-ref: c5ab0fff29b516978dbd4328dbf637e999e0db61 + url: "https://gitee.com/openharmony-sig/flutter_inappwebview.git" source: git - version: "1.0.14" + version: "1.0.13" flutter_inappwebview_macos: dependency: transitive description: - name: flutter_inappwebview_macos - sha256: b55b9e506c549ce88e26580351d2c71d54f4825901666bd6cfa4be9415bb2636 - url: "https://pub.dev" - source: hosted + path: flutter_inappwebview_macos + ref: HEAD + resolved-ref: c5ab0fff29b516978dbd4328dbf637e999e0db61 + url: "https://gitee.com/openharmony-sig/flutter_inappwebview.git" + source: git version: "1.0.11" + flutter_inappwebview_ohos: + dependency: transitive + description: + path: flutter_inappwebview_ohos + ref: HEAD + resolved-ref: c5ab0fff29b516978dbd4328dbf637e999e0db61 + url: "https://gitee.com/openharmony-sig/flutter_inappwebview.git" + source: git + version: "0.0.1" flutter_inappwebview_platform_interface: dependency: transitive description: - name: flutter_inappwebview_platform_interface - sha256: "545fd4c25a07d2775f7d5af05a979b2cac4fbf79393b0a7f5d33ba39ba4f6187" - url: "https://pub.dev" - source: hosted + path: flutter_inappwebview_platform_interface + ref: HEAD + resolved-ref: c5ab0fff29b516978dbd4328dbf637e999e0db61 + url: "https://gitee.com/openharmony-sig/flutter_inappwebview.git" + source: git version: "1.0.10" flutter_inappwebview_web: dependency: transitive description: - name: flutter_inappwebview_web - sha256: d8c680abfb6fec71609a700199635d38a744df0febd5544c5a020bd73de8ee07 - url: "https://pub.dev" - source: hosted + path: flutter_inappwebview_web + ref: HEAD + resolved-ref: c5ab0fff29b516978dbd4328dbf637e999e0db61 + url: "https://gitee.com/openharmony-sig/flutter_inappwebview.git" + source: git version: "1.0.8" flutter_localizations: dependency: "direct main" @@ -582,42 +652,42 @@ packages: dependency: "direct main" description: name: flutter_mobx - sha256: "859fbf452fa9c2519d2700b125dd7fb14c508bbdd7fb65e26ca8ff6c92280e2e" - url: "https://pub.dev" + sha256: "4a5d062ff85ed3759f4aac6410ff0ffae32e324b2e71ca722ae1b37b32e865f4" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.2.1+1" + version: "2.2.0+2" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: "9d98bd47ef9d34e803d438f17fd32b116d31009f534a6fa5ce3a1167f189a6de" - url: "https://pub.dev" + sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da + url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.21" + version: "2.0.17" flutter_riverpod: dependency: "direct main" description: name: flutter_riverpod - sha256: "0f1974eff5bbe774bf1d870e406fc6f29e3d6f1c46bd9c58e7172ff68a785d7d" - url: "https://pub.dev" + sha256: b6cb0041c6c11cefb2dcb97ef436eba43c6d41287ac6d8ca93e02a497f53a4f3 + url: "https://pub.flutter-io.cn" source: hosted - version: "2.5.1" + version: "2.3.7" flutter_staggered_animations: dependency: "direct main" description: name: flutter_staggered_animations sha256: "81d3c816c9bb0dca9e8a5d5454610e21ffb068aedb2bde49d2f8d04f75538351" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.1" flutter_svg: dependency: transitive description: name: flutter_svg - sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" - url: "https://pub.dev" + sha256: f991fdb1533c3caeee0cdc14b04f50f0c3916f0dbcbc05237ccbe4e3c6b93f3f + url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.10+1" + version: "2.0.5" flutter_test: dependency: "direct dev" description: flutter @@ -631,57 +701,50 @@ packages: flutter_widget_from_html: dependency: "direct main" description: - name: flutter_widget_from_html - sha256: "9e2a6201c4d2eb910b6b3ebb2a9f5c490fc61c9a1aa35eafdde38f0fc659cf4c" - url: "https://pub.dev" - source: hosted - version: "0.15.2" + path: "packages/enhanced" + ref: HEAD + resolved-ref: c78fd93af6a4dbb4175689a9f824550b58ed8da3 + url: "https://gitee.com/openharmony-sig/flutter_widget_from_html" + source: git + version: "0.14.11" flutter_widget_from_html_core: dependency: transitive description: name: flutter_widget_from_html_core - sha256: b1048fd119a14762e2361bd057da608148a895477846d6149109b2151d2f7abf - url: "https://pub.dev" + sha256: cc1d9be3d187ce668ee02091cd5442dfb050cdaf98e0ab9a4d12ad008f966979 + url: "https://pub.flutter-io.cn" source: hosted - version: "0.15.2" + version: "0.14.12" font_awesome_flutter: dependency: "direct main" description: name: font_awesome_flutter - sha256: "275ff26905134bcb59417cf60ad979136f1f8257f2f449914b2c3e05bbb4cd6f" - url: "https://pub.dev" + sha256: "959ef4add147753f990b4a7c6cccb746d5792dbdc81b1cde99e62e7edb31b206" + url: "https://pub.flutter-io.cn" source: hosted - version: "10.7.0" - freezed: - dependency: "direct dev" - description: - name: freezed - sha256: "44c19278dd9d89292cf46e97dc0c1e52ce03275f40a97c5a348e802a924bf40e" - url: "https://pub.dev" - source: hosted - version: "2.5.7" + version: "10.4.0" freezed_annotation: dependency: "direct main" description: name: freezed_annotation - sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2 - url: "https://pub.dev" + sha256: c3fd9336eb55a38cc1bbd79ab17573113a8deccd0ecbbf926cca3c62803b5c2d + url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.4" + version: "2.4.1" frontend_server_client: dependency: transitive description: name: frontend_server_client - sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 - url: "https://pub.dev" + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.flutter-io.cn" source: hosted - version: "4.0.0" + version: "3.2.0" fwfh_cached_network_image: dependency: transitive description: name: fwfh_cached_network_image sha256: "8e44226801bfba27930673953afce8af44da7e92573be93f60385d9865a089dd" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.14.3" fwfh_chewie: @@ -689,23 +752,23 @@ packages: description: name: fwfh_chewie sha256: "37bde9cedfb6dc5546176f7f0c56af1e814966cb33ec58f16c9565ed93ccb704" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.14.8" fwfh_just_audio: dependency: transitive description: name: fwfh_just_audio - sha256: "38dc2c55803bd3cef33042c473e0c40b891ad4548078424641a32032f6a1245f" - url: "https://pub.dev" + sha256: "209cf9644599e37b0edb6961c4f30ce80d156f5a53a50355f75fb4a22f9fdb0a" + url: "https://pub.flutter-io.cn" source: hosted - version: "0.15.2" + version: "0.14.3" fwfh_svg: dependency: transitive description: name: fwfh_svg sha256: "550b1014d12b5528d8bdb6e3b44b58721f3fb1f65d7a852d1623a817008bdfc4" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.8.3" fwfh_url_launcher: @@ -713,87 +776,79 @@ packages: description: name: fwfh_url_launcher sha256: b9f5d55a5ae2c2c07243ba33f7ba49ac9544bdb2f4c16d8139df9ccbebe3449c - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.9.1" fwfh_webview: dependency: transitive description: name: fwfh_webview - sha256: f67890bc0d6278da98bd197469ae9511c859f7db327e92299fe0ea0cf46c4057 - url: "https://pub.dev" + sha256: b828bb5ddd4361a866cdb8f1b0de4f3348f332915ecf2f4215ba17e46c656adc + url: "https://pub.flutter-io.cn" source: hosted - version: "0.15.2" + version: "0.14.8" get_it: dependency: transitive description: name: get_it - sha256: d85128a5dae4ea777324730dc65edd9c9f43155c109d5cc0a69cab74139fbac1 - url: "https://pub.dev" + sha256: "529de303c739fca98cd7ece5fca500d8ff89649f1bb4b4e94fb20954abcd7468" + url: "https://pub.flutter-io.cn" source: hosted - version: "7.7.0" + version: "7.6.0" glob: dependency: transitive description: name: glob sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" graphs: dependency: transitive description: name: graphs - sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" - url: "https://pub.dev" + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 + url: "https://pub.flutter-io.cn" source: hosted - version: "2.3.2" + version: "2.3.1" hooks_riverpod: dependency: "direct main" description: name: hooks_riverpod - sha256: "97266a91c994951a06ef0ff3a1c7fb261e52ec7f74e87f0614ea0b7411b859b2" - url: "https://pub.dev" + sha256: "2bb8ae6a729e1334f71f1ef68dd5f0400dca8f01de8cbdcde062584a68017b18" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.5.2" - hotreloader: - dependency: transitive - description: - name: hotreloader - sha256: ed56fdc1f3a8ac924e717257621d09e9ec20e308ab6352a73a50a1d7a4d9158e - url: "https://pub.dev" - source: hosted - version: "4.2.0" + version: "2.3.8" html: dependency: transitive description: name: html sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.15.4" http: dependency: "direct main" description: name: http - sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 - url: "https://pub.dev" + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.2" + version: "0.13.6" http_interceptor: dependency: "direct main" description: name: http_interceptor - sha256: "288c6ded4a2c66de2730a16b30cbd29d05d042a5e61304d9b4be0e16378f4082" - url: "https://pub.dev" + sha256: "94b5b191abb2d18a76780a2c5feffb900e54cad16f61ffcfc16997785e21d383" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.0" + version: "2.0.0-beta.6" http_multi_server: dependency: transitive description: name: http_multi_server sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.1" http_parser: @@ -801,7 +856,7 @@ packages: description: name: http_parser sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "4.0.2" image: @@ -809,47 +864,48 @@ packages: description: name: image sha256: "2237616a36c0d69aef7549ab439b833fb7f9fb9fc861af2cc9ac3eedddd69ca8" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "4.2.0" image_picker: dependency: "direct main" description: - name: image_picker - sha256: "021834d9c0c3de46bf0fe40341fa07168407f694d9b2bb18d532dc1261867f7a" - url: "https://pub.dev" - source: hosted - version: "1.1.2" + path: "packages/image_picker/image_picker" + ref: HEAD + resolved-ref: "67a2fe8b47eb5eb845aa320e08c3c51390033c83" + url: "https://gitee.com/openharmony-sig/flutter_packages.git" + source: git + version: "1.0.2" image_picker_android: dependency: transitive description: name: image_picker_android - sha256: "8c5abf0dcc24fe6e8e0b4a5c0b51a5cf30cefdf6407a3213dae61edc75a70f56" - url: "https://pub.dev" + sha256: d6a6e78821086b0b737009b09363018309bbc6de3fd88cc5c26bc2bb44a4957f + url: "https://pub.flutter-io.cn" source: hosted - version: "0.8.12+12" + version: "0.8.8+2" image_picker_for_web: dependency: transitive description: name: image_picker_for_web - sha256: "65d94623e15372c5c51bebbcb820848d7bcb323836e12dfdba60b5d3a8b39e50" - url: "https://pub.dev" + sha256: "50bc9ae6a77eea3a8b11af5eb6c661eeb858fdd2f734c2a4fd17086922347ef7" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.0.5" + version: "3.0.1" image_picker_ios: dependency: transitive description: name: image_picker_ios - sha256: "6703696ad49f5c3c8356d576d7ace84d1faf459afb07accbb0fae780753ff447" - url: "https://pub.dev" + sha256: "76ec722aeea419d03aa915c2c96bf5b47214b053899088c9abb4086ceecf97a7" + url: "https://pub.flutter-io.cn" source: hosted - version: "0.8.12" + version: "0.8.8+4" image_picker_linux: dependency: transitive description: name: image_picker_linux sha256: "4ed1d9bb36f7cd60aa6e6cd479779cc56a4cb4e4de8f49d487b1aaad831300fa" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.1+1" image_picker_macos: @@ -857,151 +913,136 @@ packages: description: name: image_picker_macos sha256: "3f5ad1e8112a9a6111c46d0b57a7be2286a9a07fc6e1976fdf5be2bd31d4ff62" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.1+1" + image_picker_ohos: + dependency: transitive + description: + path: "packages/image_picker/image_picker_ohos" + ref: HEAD + resolved-ref: "67a2fe8b47eb5eb845aa320e08c3c51390033c83" + url: "https://gitee.com/openharmony-sig/flutter_packages.git" + source: git + version: "0.8.7+4" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface - sha256: "9ec26d410ff46f483c5519c29c02ef0e02e13a543f882b152d4bfd2f06802f80" - url: "https://pub.dev" + sha256: ed9b00e63977c93b0d2d2b343685bed9c324534ba5abafbb3dfbd6a780b1b514 + url: "https://pub.flutter-io.cn" source: hosted - version: "2.10.0" + version: "2.9.1" image_picker_windows: dependency: transitive description: name: image_picker_windows sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.1+1" in_app_purchase: dependency: "direct main" description: name: in_app_purchase - sha256: "960f26a08d9351fb8f89f08901f8a829d41b04d45a694b8f776121d9e41dcad6" - url: "https://pub.dev" + sha256: bdda02b5b11b56d5e29c7f0c57c433db3452b0c8ce1c37cbfcf1de52946efd9f + url: "https://pub.flutter-io.cn" source: hosted - version: "3.2.0" + version: "3.1.11" in_app_purchase_android: dependency: transitive description: name: in_app_purchase_android - sha256: f26ca0bd50cd25b5bc832bd86f2a99e5959b3f9ad87ecbd4a28571495cb388a7 - url: "https://pub.dev" + sha256: c4b84caa4e2c7ffebda444c5033fd8423cc3a45a6e1066929bbbcd4daf665db5 + url: "https://pub.flutter-io.cn" source: hosted - version: "0.3.6+6" + version: "0.3.0+15" in_app_purchase_platform_interface: dependency: transitive description: name: in_app_purchase_platform_interface - sha256: "1d353d38251da5b9fea6635c0ebfc6bb17a2d28d0e86ea5e083bf64244f1fb4c" - url: "https://pub.dev" + sha256: "5168afbc54f406f741252b66d41872c1193a0066a6edcb587176290b92e2d537" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.4.0" + version: "1.3.6" in_app_purchase_storekit: dependency: transitive description: name: in_app_purchase_storekit - sha256: "28a0577d9f4a5bdfb7aad96c347193e1225cc335c8003fbb98b875a67dab34cc" - url: "https://pub.dev" + sha256: "88afd256c7605d431f0ce29d0161f9554851f90ecb92ceb9e18196c4e7858d52" + url: "https://pub.flutter-io.cn" source: hosted - version: "0.3.17+3" + version: "0.3.6+7" intl: dependency: "direct main" description: name: intl - sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf - url: "https://pub.dev" + sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91" + url: "https://pub.flutter-io.cn" source: hosted - version: "0.19.0" + version: "0.17.0" io: dependency: transitive description: name: io sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.4" js: dependency: transitive description: name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + url: "https://pub.flutter-io.cn" source: hosted - version: "0.6.7" + version: "0.6.5" json_annotation: dependency: "direct main" description: name: json_annotation - sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" - url: "https://pub.dev" + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + url: "https://pub.flutter-io.cn" source: hosted - version: "4.9.0" + version: "4.8.1" json_serializable: dependency: "direct dev" description: name: json_serializable - sha256: ea1432d167339ea9b5bb153f0571d0039607a873d6e04e0117af043f14a1fd4b - url: "https://pub.dev" + sha256: "43793352f90efa5d8b251893a63d767b2f7c833120e3cc02adad55eefec04dc7" + url: "https://pub.flutter-io.cn" source: hosted - version: "6.8.0" + version: "6.6.2" just_audio: dependency: transitive description: name: just_audio - sha256: ee50602364ba83fa6308f5512dd560c713ec3e1f2bc75f0db43618f0d82ef71a - url: "https://pub.dev" + sha256: b7cb6bbf3750caa924d03f432ba401ec300fd90936b3f73a9b33d58b1e96286b + url: "https://pub.flutter-io.cn" source: hosted - version: "0.9.39" + version: "0.9.37" just_audio_platform_interface: dependency: transitive description: name: just_audio_platform_interface sha256: "0243828cce503c8366cc2090cefb2b3c871aa8ed2f520670d76fd47aa1ab2790" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "4.3.0" just_audio_web: dependency: transitive description: name: just_audio_web - sha256: b163878529d9b028c53a6972fcd58cae2405bcd11cbfcea620b6fb9f151429d6 - url: "https://pub.dev" - source: hosted - version: "0.4.12" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" - url: "https://pub.dev" - source: hosted - version: "10.0.5" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" - url: "https://pub.dev" + sha256: "134356b0fe3d898293102b33b5fd618831ffdc72bb7a1b726140abdf22772b70" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.0.5" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" - url: "https://pub.dev" - source: hosted - version: "3.0.1" + version: "0.4.9" logging: dependency: transitive description: name: logging sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" macos_window_utils: @@ -1009,79 +1050,63 @@ packages: description: name: macos_window_utils sha256: "230be594d26f6dee92c5a1544f4242d25138a5bfb9f185b27f14de3949ef0be8" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.0" - macros: - dependency: transitive - description: - name: macros - sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536" - url: "https://pub.dev" - source: hosted - version: "0.1.2-main.4" matcher: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb - url: "https://pub.dev" + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + url: "https://pub.flutter-io.cn" source: hosted - version: "0.12.16+1" + version: "0.12.13" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec - url: "https://pub.dev" - source: hosted - version: "0.11.1" - math_expressions: - dependency: transitive - description: - name: math_expressions - sha256: e32d803d758ace61cc6c4bdfed1226ff60a6a23646b35685670d28b5616139f8 - url: "https://pub.dev" + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.flutter-io.cn" source: hosted - version: "2.6.0" + version: "0.2.0" meta: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 - url: "https://pub.dev" + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.15.0" + version: "1.8.0" mime: dependency: transitive description: name: mime - sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" - url: "https://pub.dev" + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.5" + version: "1.0.4" mobx: dependency: "direct main" description: name: mobx - sha256: "63920b27b32ad1910adfe767ab1750e4c212e8923232a1f891597b362074ea5e" - url: "https://pub.dev" + sha256: "0377639a02a79524454dbac128fc624e5afc032337a0d0c246017ad23f77d5d3" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.3.3+2" + version: "2.3.2" mobx_codegen: dependency: "direct dev" description: name: mobx_codegen - sha256: "8e0d8653a0c720ad933cd8358f6f89f740ce89203657c13f25bea772ef1fff7c" - url: "https://pub.dev" + sha256: d4beb9cea4b7b014321235f8fdc7c2193ee0fe1d1198e9da7403f8bc85c4407c + url: "https://pub.flutter-io.cn" source: hosted - version: "2.6.1" + version: "2.3.0" msix: dependency: "direct dev" description: name: msix sha256: c50d6bd1aafe0d071a3c1e5a5ccb056404502935cb0a549e3178c4aae16caf33 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.16.8" nested: @@ -1089,55 +1114,81 @@ packages: description: name: nested sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" + network_info_plus: + dependency: "direct overridden" + description: + path: "packages/network_info_plus/network_info_plus" + ref: HEAD + resolved-ref: "452bfb40465722552f31cf78cde60f99cc691e36" + url: "https://gitee.com/openharmony-sig/flutter_plus_plugins.git" + source: git + version: "4.1.0" + network_info_plus_platform_interface: + dependency: transitive + description: + name: network_info_plus_platform_interface + sha256: "881f5029c5edaf19c616c201d3d8b366c5b1384afd5c1da5a49e4345de82fb8b" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.3" + nm: + dependency: transitive + description: + name: nm + sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.5.0" octo_image: dependency: transitive description: name: octo_image - sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd" - url: "https://pub.dev" + sha256: "107f3ed1330006a3bea63615e81cf637433f5135a52466c7caa0e7152bca9143" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.0" + version: "1.0.2" package_config: dependency: transitive description: name: package_config sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" package_info_plus: dependency: "direct main" description: - name: package_info_plus - sha256: a75164ade98cb7d24cfd0a13c6408927c6b217fa60dee5a7ff5c116a58f28918 - url: "https://pub.dev" - source: hosted - version: "8.0.2" + path: "packages/package_info_plus/package_info_plus" + ref: HEAD + resolved-ref: "452bfb40465722552f31cf78cde60f99cc691e36" + url: "https://gitee.com/openharmony-sig/flutter_plus_plugins.git" + source: git + version: "4.2.0" package_info_plus_platform_interface: dependency: transitive description: name: package_info_plus_platform_interface - sha256: ac1f4a4847f1ade8e6a87d1f39f5d7c67490738642e2542f559ec38c37489a66 - url: "https://pub.dev" + sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.0.1" + version: "2.0.1" path: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" - url: "https://pub.dev" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.flutter-io.cn" source: hosted - version: "1.9.0" + version: "1.8.2" path_drawing: dependency: transitive description: name: path_drawing sha256: bbb1934c0cbb03091af082a6389ca2080345291ef07a5fa6d6e078ba8682f977 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" path_parsing: @@ -1145,143 +1196,163 @@ packages: description: name: path_parsing sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" path_provider: dependency: "direct main" description: - name: path_provider - sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 - url: "https://pub.dev" - source: hosted - version: "2.1.4" + path: "packages/path_provider/path_provider" + ref: HEAD + resolved-ref: "67a2fe8b47eb5eb845aa320e08c3c51390033c83" + url: "https://gitee.com/openharmony-sig/flutter_packages.git" + source: git + version: "2.1.0" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: "6f01f8e37ec30b07bc424b4deabac37cacb1bc7e2e515ad74486039918a37eb7" - url: "https://pub.dev" + sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 + url: "https://pub.flutter-io.cn" source: hosted - version: "2.2.10" + version: "2.2.1" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 - url: "https://pub.dev" + sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.0" + version: "2.3.1" path_provider_linux: dependency: transitive description: name: path_provider_linux sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.1" + path_provider_ohos: + dependency: "direct overridden" + description: + path: "packages/path_provider/path_provider_ohos" + ref: HEAD + resolved-ref: "67a2fe8b47eb5eb845aa320e08c3c51390033c83" + url: "https://gitee.com/openharmony-sig/flutter_packages.git" + source: git + version: "2.2.1" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" - url: "https://pub.dev" + sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.2" + version: "2.1.1" path_provider_windows: dependency: transitive description: name: path_provider_windows - sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 - url: "https://pub.dev" + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.3.0" + version: "2.2.1" permission_handler: dependency: "direct main" description: - name: permission_handler - sha256: "18bf33f7fefbd812f37e72091a15575e72d5318854877e0e4035a24ac1113ecb" - url: "https://pub.dev" - source: hosted - version: "11.3.1" + path: permission_handler + ref: HEAD + resolved-ref: "33f9cf41cd66fe36af0db69c36fb7dd9eb3b1456" + url: "https://gitee.com/openharmony-sig/flutter_permission_handler.git" + source: git + version: "10.4.3" permission_handler_android: dependency: transitive description: name: permission_handler_android - sha256: "76e4ab092c1b240d31177bb64d2b0bea43f43d0e23541ec866151b9f7b2490fa" - url: "https://pub.dev" + sha256: "59c6322171c29df93a22d150ad95f3aa19ed86542eaec409ab2691b8f35f9a47" + url: "https://pub.flutter-io.cn" source: hosted - version: "12.0.12" + version: "10.3.6" permission_handler_apple: dependency: transitive description: name: permission_handler_apple - sha256: e6f6d73b12438ef13e648c4ae56bd106ec60d17e90a59c4545db6781229082a0 - url: "https://pub.dev" + sha256: "99e220bce3f8877c78e4ace901082fb29fa1b4ebde529ad0932d8d664b34f3f5" + url: "https://pub.flutter-io.cn" source: hosted - version: "9.4.5" - permission_handler_html: + version: "9.1.4" + permission_handler_ohos: dependency: transitive description: - name: permission_handler_html - sha256: d220eb8476b466d58b161e10b3001d93999010a26228a3fb89c4280db1249546 - url: "https://pub.dev" - source: hosted - version: "0.1.3+1" + path: permission_handler_ohos + ref: master + resolved-ref: "33f9cf41cd66fe36af0db69c36fb7dd9eb3b1456" + url: "https://gitee.com/openharmony-sig/flutter_permission_handler.git" + source: git + version: "10.3.2" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - sha256: fe0ffe274d665be8e34f9c59705441a7d248edebbe5d9e3ec2665f88b79358ea - url: "https://pub.dev" + sha256: "6760eb5ef34589224771010805bea6054ad28453906936f843a8cc4d3a55c4a4" + url: "https://pub.flutter-io.cn" source: hosted - version: "4.2.2" + version: "3.12.0" permission_handler_windows: dependency: transitive description: name: permission_handler_windows - sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e" - url: "https://pub.dev" + sha256: cc074aace208760f1eee6aa4fae766b45d947df85bc831cde77009cdb4720098 + url: "https://pub.flutter-io.cn" source: hosted - version: "0.2.1" + version: "0.1.3" petitparser: dependency: transitive description: name: petitparser - sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 - url: "https://pub.dev" + sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4" + url: "https://pub.flutter-io.cn" source: hosted - version: "6.0.2" + version: "5.1.0" photo_view: dependency: "direct main" description: name: photo_view sha256: "1fc3d970a91295fbd1364296575f854c9863f225505c28c46e0a03e48960c75e" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.15.0" platform: dependency: transitive description: name: platform - sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" - url: "https://pub.dev" + sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.1.5" + version: "3.1.3" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" - url: "https://pub.dev" + sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d + url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.8" + version: "2.1.6" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.7.3" pool: dependency: transitive description: name: pool sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.1" provider: @@ -1289,7 +1360,7 @@ packages: description: name: provider sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "6.1.2" pub_semver: @@ -1297,193 +1368,165 @@ packages: description: name: pub_semver sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.4" pubspec_parse: dependency: transitive description: name: pubspec_parse - sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 - url: "https://pub.dev" + sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 + url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0" + version: "1.2.3" quiver: dependency: "direct main" description: name: quiver sha256: ea0b925899e64ecdfbf9c7becb60d5b50e706ade44a85b2363be2a22d88117d2 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.2" - recase: - dependency: transitive - description: - name: recase - sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 - url: "https://pub.dev" - source: hosted - version: "4.1.0" receive_sharing_intent: dependency: "direct main" description: name: receive_sharing_intent - sha256: f127989f8662ea15e193bd1e10605e5a0ab6bb92dffd51f3ce002feb0ce24c93 - url: "https://pub.dev" + sha256: fcf167ad5aed85937c42d985dc31c7e50dbb3cf97dc5063a2bcfd26147023b34 + url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.0" + version: "1.6.8" riverpod: dependency: transitive description: name: riverpod - sha256: f21b32ffd26a36555e501b04f4a5dca43ed59e16343f1a30c13632b2351dfa4d - url: "https://pub.dev" + sha256: b0657b5b30c81a3184bdaab353045f0a403ebd60bb381591a8b7ad77dcade793 + url: "https://pub.flutter-io.cn" source: hosted - version: "2.5.1" - riverpod_analyzer_utils: - dependency: transitive - description: - name: riverpod_analyzer_utils - sha256: ac28d7bc678471ec986b42d88e5a0893513382ff7542c7ac9634463b044ac72c - url: "https://pub.dev" - source: hosted - version: "0.5.4" + version: "2.3.7" riverpod_annotation: dependency: "direct main" description: name: riverpod_annotation - sha256: e5e796c0eba4030c704e9dae1b834a6541814963292839dcf9638d53eba84f5c - url: "https://pub.dev" - source: hosted - version: "2.3.5" - riverpod_generator: - dependency: "direct dev" - description: - name: riverpod_generator - sha256: "63311e361ffc578d655dfc31b48dfa4ed3bc76fd06f9be845e9bf97c5c11a429" - url: "https://pub.dev" - source: hosted - version: "2.4.3" - riverpod_lint: - dependency: "direct dev" - description: - name: riverpod_lint - sha256: a35a92f2c2a4b7a5d95671c96c5432b42c20f26bb3e985e83d0b186471b61a85 - url: "https://pub.dev" + sha256: "8b3f7a54ddd5d53d6ea04bfb4ff77ee1b0816a1b563c0d9d43e73ce94bf2016d" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.3.13" + version: "2.1.2" rxdart: dependency: transitive description: name: rxdart - sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" - url: "https://pub.dev" + sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" + url: "https://pub.flutter-io.cn" source: hosted - version: "0.28.0" + version: "0.27.7" screen_retriever: dependency: transitive description: name: screen_retriever sha256: "6ee02c8a1158e6dae7ca430da79436e3b1c9563c8cf02f524af997c201ac2b90" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.9" - scroll_pos: - dependency: transitive - description: - name: scroll_pos - sha256: cebf602b2dd939de6832bb902ffefb574608d1b84f420b82b381a4007d3c1e1b - url: "https://pub.dev" - source: hosted - version: "0.5.0" share_plus: dependency: "direct main" description: - name: share_plus - sha256: "468c43f285207c84bcabf5737f33b914ceb8eb38398b91e5e3ad1698d1b72a52" - url: "https://pub.dev" - source: hosted - version: "10.0.2" + path: "packages/share_plus/share_plus" + ref: HEAD + resolved-ref: "452bfb40465722552f31cf78cde60f99cc691e36" + url: "https://gitee.com/openharmony-sig/flutter_plus_plugins.git" + source: git + version: "7.2.0" share_plus_platform_interface: dependency: transitive description: - name: share_plus_platform_interface - sha256: "6ababf341050edff57da8b6990f11f4e99eaba837865e2e6defe16d039619db5" - url: "https://pub.dev" - source: hosted - version: "5.0.0" + path: "packages/share_plus/share_plus_platform_interface" + ref: master + resolved-ref: "452bfb40465722552f31cf78cde60f99cc691e36" + url: "https://gitee.com/openharmony-sig/flutter_plus_plugins.git" + source: git + version: "3.3.0" shared_preferences: dependency: "direct main" description: - name: shared_preferences - sha256: "746e5369a43170c25816cc472ee016d3a66bc13fcf430c0bc41ad7b4b2922051" - url: "https://pub.dev" - source: hosted - version: "2.3.2" + path: "packages/shared_preferences/shared_preferences" + ref: HEAD + resolved-ref: "67a2fe8b47eb5eb845aa320e08c3c51390033c83" + url: "https://gitee.com/openharmony-sig/flutter_packages.git" + source: git + version: "2.2.0" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: a7e8467e9181cef109f601e3f65765685786c1a738a83d7fbbde377589c0d974 - url: "https://pub.dev" + sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.3.1" + version: "2.2.1" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: c4b35f6cb8f63c147312c054ce7c2254c8066745125264f0c88739c417fc9d9f - url: "https://pub.dev" + sha256: "7bf53a9f2d007329ee6f3df7268fd498f8373602f943c975598bbb34649b62a7" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.5.2" + version: "2.3.4" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" - url: "https://pub.dev" + sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.1" + version: "2.3.2" + shared_preferences_ohos: + dependency: transitive + description: + path: "packages/shared_preferences/shared_preferences_ohos" + ref: HEAD + resolved-ref: "67a2fe8b47eb5eb845aa320e08c3c51390033c83" + url: "https://gitee.com/openharmony-sig/flutter_packages.git" + source: git + version: "2.2.0" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" - url: "https://pub.dev" + sha256: d4ec5fc9ebb2f2e056c617112aa75dcf92fc2e4faaf2ae999caa297473f75d8a + url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.1" + version: "2.3.1" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e - url: "https://pub.dev" + sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf + url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.2" + version: "2.2.1" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" - url: "https://pub.dev" + sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.1" + version: "2.3.2" shelf: dependency: transitive description: name: shelf sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.4.1" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" - url: "https://pub.dev" + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.0" + version: "1.0.4" sky_engine: dependency: transitive description: flutter @@ -1493,96 +1536,88 @@ packages: dependency: transitive description: name: source_gen - sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" - url: "https://pub.dev" + sha256: "373f96cf5a8744bc9816c1ff41cf5391bbdbe3d7a96fe98c622b6738a8a7bd33" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.5.0" + version: "1.3.2" source_helper: dependency: transitive description: name: source_helper sha256: "6adebc0006c37dd63fe05bca0a929b99f06402fc95aa35bf36d67f5c06de01fd" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.4" source_span: dependency: transitive description: name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.dev" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.flutter-io.cn" source: hosted - version: "1.10.0" - sprintf: - dependency: transitive - description: - name: sprintf - sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" - url: "https://pub.dev" - source: hosted - version: "7.0.0" + version: "1.9.1" sqflite: dependency: "direct main" description: name: sqflite - sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d - url: "https://pub.dev" + sha256: b4d6710e1200e96845747e37338ea8a819a12b51689a3bcf31eff0003b37a0b9 + url: "https://pub.flutter-io.cn" source: hosted - version: "2.3.3+1" + version: "2.2.8+4" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "7b41b6c3507854a159e24ae90a8e3e9cc01eb26a477c118d6dca065b5f55453e" - url: "https://pub.dev" + sha256: "8f7603f3f8f126740bc55c4ca2d1027aab4b74a1267a3e31ce51fe40e3b65b8f" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.5.4+2" + version: "2.4.5+1" sqflite_common_ffi: dependency: "direct dev" description: name: sqflite_common_ffi - sha256: "4d6137c29e930d6e4a8ff373989dd9de7bac12e3bc87bce950f6e844e8ad3bb5" - url: "https://pub.dev" + sha256: f86de82d37403af491b21920a696b19f01465b596f545d1acd4d29a0a72418ad + url: "https://pub.flutter-io.cn" source: hosted - version: "2.3.3" + version: "2.2.5" sqlite3: dependency: transitive description: name: sqlite3 - sha256: "45f168ae2213201b54e09429ed0c593dc2c88c924a1488d6f9c523a255d567cb" - url: "https://pub.dev" + sha256: "281b672749af2edf259fc801f0fcba092257425bcd32a0ce1c8237130bc934c7" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.6" + version: "1.11.2" stack_trace: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" - url: "https://pub.dev" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.flutter-io.cn" source: hosted - version: "1.11.1" + version: "1.11.0" state_notifier: dependency: transitive description: name: state_notifier sha256: b8677376aa54f2d7c58280d5a007f9e8774f1968d1fb1c096adcb4792fba29bb - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" stream_channel: dependency: transitive description: name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 - url: "https://pub.dev" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.2" + version: "2.1.1" stream_transform: dependency: transitive description: name: stream_transform sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" string_scanner: @@ -1590,39 +1625,39 @@ packages: description: name: string_scanner sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" synchronized: dependency: transitive description: name: synchronized - sha256: a824e842b8a054f91a728b783c177c1e4731f6b124f9192468457a8913371255 - url: "https://pub.dev" + sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.2.0" + version: "3.1.0" term_glyph: dependency: transitive description: name: term_glyph sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.1" test_api: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" - url: "https://pub.dev" + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + url: "https://pub.flutter-io.cn" source: hosted - version: "0.7.2" + version: "0.4.16" timing: dependency: transitive description: name: timing sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" typed_data: @@ -1630,305 +1665,299 @@ packages: description: name: typed_data sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.2" + upower: + dependency: transitive + description: + name: upower + sha256: cf042403154751180affa1d15614db7fa50234bc2373cd21c3db666c38543ebf + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.7.0" url_launcher: dependency: "direct main" description: - name: url_launcher - sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3" - url: "https://pub.dev" - source: hosted - version: "6.3.0" + path: "packages/url_launcher/url_launcher" + ref: HEAD + resolved-ref: "67a2fe8b47eb5eb845aa320e08c3c51390033c83" + url: "https://gitee.com/openharmony-sig/flutter_packages.git" + source: git + version: "6.1.12" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: f0c73347dfcfa5b3db8bc06e1502668265d39c08f310c29bff4e28eea9699f79 - url: "https://pub.dev" + sha256: "31222ffb0063171b526d3e569079cf1f8b294075ba323443fdc690842bfd4def" + url: "https://pub.flutter-io.cn" source: hosted - version: "6.3.9" + version: "6.2.0" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: e43b677296fadce447e987a2f519dcf5f6d1e527dc35d01ffab4fff5b8a7063e - url: "https://pub.dev" + sha256: "4ac97281cf60e2e8c5cc703b2b28528f9b50c8f7cebc71df6bdf0845f647268a" + url: "https://pub.flutter-io.cn" source: hosted - version: "6.3.1" + version: "6.2.0" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: e2b9622b4007f97f504cd64c0128309dfb978ae66adbe944125ed9e1750f06af - url: "https://pub.dev" + sha256: "9f2d390e096fdbe1e6e6256f97851e51afc2d9c423d3432f1d6a02a8a9a8b9fd" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.2.0" + version: "3.1.0" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de" - url: "https://pub.dev" + sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 + url: "https://pub.flutter-io.cn" source: hosted - version: "3.2.0" + version: "3.1.0" + url_launcher_ohos: + dependency: transitive + description: + path: "packages/url_launcher/url_launcher_ohos" + ref: HEAD + resolved-ref: "67a2fe8b47eb5eb845aa320e08c3c51390033c83" + url: "https://gitee.com/openharmony-sig/flutter_packages.git" + source: git + version: "6.0.38" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" - url: "https://pub.dev" + sha256: "980e8d9af422f477be6948bdfb68df8433be71f5743a188968b0c1b887807e50" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.3.2" + version: "2.2.0" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" - url: "https://pub.dev" + sha256: ba140138558fcc3eead51a1c42e92a9fb074a1b1149ed3c73e66035b2ccd94f2 + url: "https://pub.flutter-io.cn" source: hosted - version: "2.3.3" + version: "2.0.19" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: "49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185" - url: "https://pub.dev" + sha256: "7754a1ad30ee896b265f8d14078b0513a4dba28d358eabb9d5f339886f4a1adc" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.1.2" + version: "3.1.0" uuid: dependency: transitive description: name: uuid - sha256: "83d37c7ad7aaf9aa8e275490669535c8080377cfa7a7004c24dfac53afffaa90" - url: "https://pub.dev" + sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + url: "https://pub.flutter-io.cn" source: hosted - version: "4.4.2" + version: "3.0.7" vector_graphics: dependency: transitive description: name: vector_graphics - sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" - url: "https://pub.dev" + sha256: ea8d3fc7b2e0f35de38a7465063ecfcf03d8217f7962aa2a6717132cb5d43a79 + url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.11+1" + version: "1.1.5" vector_graphics_codec: dependency: transitive description: name: vector_graphics_codec - sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da - url: "https://pub.dev" + sha256: a5eaa5d19e123ad4f61c3718ca1ed921c4e6254238d9145f82aa214955d9aced + url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.11+1" + version: "1.1.5" vector_graphics_compiler: dependency: transitive description: name: vector_graphics_compiler - sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" - url: "https://pub.dev" + sha256: "15edc42f7eaa478ce854eaf1fbb9062a899c0e4e56e775dd73b7f4709c97c4ca" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.11+1" + version: "1.1.5" vector_math: dependency: transitive description: name: vector_math sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.4" video_player: dependency: transitive description: name: video_player - sha256: e30df0d226c4ef82e2c150ebf6834b3522cf3f654d8e2f9419d376cdc071425d - url: "https://pub.dev" + sha256: "74b86e63529cf5885130c639d74cd2f9232e7c8a66cbecbddd1dcb9dbd060d1e" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.9.1" + version: "2.7.2" video_player_android: dependency: transitive description: name: video_player_android - sha256: "4de50df9ee786f5891d3281e1e633d7b142ef1acf47392592eb91cba5d355849" - url: "https://pub.dev" + sha256: "3fe89ab07fdbce786e7eb25b58532d6eaf189ceddc091cb66cba712f8d9e8e55" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.6.0" + version: "2.4.10" video_player_avfoundation: dependency: transitive description: name: video_player_avfoundation - sha256: d1e9a824f2b324000dc8fb2dcb2a3285b6c1c7c487521c63306cc5b394f68a7c - url: "https://pub.dev" + sha256: bf1a1322bf68bccd349982ba1f5a41314a3880861fb9a93d25d6d0a2345845f0 + url: "https://pub.flutter-io.cn" source: hosted - version: "2.6.1" + version: "2.4.11" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface - sha256: "236454725fafcacf98f0f39af0d7c7ab2ce84762e3b63f2cbb3ef9a7e0550bc6" - url: "https://pub.dev" + sha256: be72301bf2c0150ab35a8c34d66e5a99de525f6de1e8d27c0672b836fe48f73a + url: "https://pub.flutter-io.cn" source: hosted - version: "6.2.2" + version: "6.2.1" video_player_web: dependency: transitive description: name: video_player_web - sha256: "6dcdd298136523eaf7dfc31abaf0dfba9aa8a8dbc96670e87e9d42b6f2caf774" - url: "https://pub.dev" + sha256: "9c34a243785feca23148bfcd772dbb803d63c9304488177ec4f3f4463802fcb7" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.3.2" + version: "2.0.17" visibility_detector: dependency: transitive description: name: visibility_detector sha256: dd5cc11e13494f432d15939c3aa8ae76844c42b723398643ce9addb88a5ed420 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.0+2" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" - url: "https://pub.dev" - source: hosted - version: "14.2.5" wakelock_plus: dependency: transitive description: name: wakelock_plus - sha256: bf4ee6f17a2fa373ed3753ad0e602b7603f8c75af006d5b9bdade263928c0484 - url: "https://pub.dev" + sha256: f268ca2116db22e57577fb99d52515a24bdc1d570f12ac18bb762361d43b043d + url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.8" + version: "1.1.4" wakelock_plus_platform_interface: dependency: transitive description: name: wakelock_plus_platform_interface - sha256: "422d1cdbb448079a8a62a5a770b69baa489f8f7ca21aef47800c726d404f9d16" - url: "https://pub.dev" + sha256: "40fabed5da06caff0796dc638e1f07ee395fb18801fbff3255a2372db2d80385" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.1" + version: "1.1.0" watcher: dependency: transitive description: name: watcher - sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" - url: "https://pub.dev" + sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0" + version: "1.0.2" waterfall_flow: dependency: "direct main" description: name: waterfall_flow sha256: "11538b0d890458e55e6248b177732495d20893cfc7e85d7e8dbf4fdce61c9f10" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.3" - web: - dependency: transitive - description: - name: web - sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 - url: "https://pub.dev" - source: hosted - version: "1.0.0" - web_socket: - dependency: transitive - description: - name: web_socket - sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" - url: "https://pub.dev" - source: hosted - version: "0.1.6" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" - url: "https://pub.dev" + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.flutter-io.cn" source: hosted - version: "3.0.1" + version: "2.4.0" webview_flutter: dependency: transitive description: name: webview_flutter - sha256: "6869c8786d179f929144b4a1f86e09ac0eddfe475984951ea6c634774c16b522" - url: "https://pub.dev" + sha256: "42393b4492e629aa3a88618530a4a00de8bb46e50e7b3993fedbfdc5352f0dbf" + url: "https://pub.flutter-io.cn" source: hosted - version: "4.8.0" + version: "4.4.2" webview_flutter_android: - dependency: "direct dev" + dependency: transitive description: name: webview_flutter_android - sha256: dad3313c9ead95517bb1cae5e1c9d20ba83729d5a59e5e83c0a2d66203f27f91 - url: "https://pub.dev" + sha256: "8326ee235f87605a2bfc444a4abc897f4abc78d83f054ba7d3d1074ce82b4fbf" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.16.1" + version: "3.12.1" webview_flutter_platform_interface: dependency: transitive description: name: webview_flutter_platform_interface - sha256: d937581d6e558908d7ae3dc1989c4f87b786891ab47bb9df7de548a151779d8d - url: "https://pub.dev" + sha256: "6d9213c65f1060116757a7c473247c60f3f7f332cac33dc417c9e362a9a13e4f" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.10.0" + version: "2.6.0" webview_flutter_wkwebview: dependency: transitive description: name: webview_flutter_wkwebview - sha256: "9c62cc46fa4f2d41e10ab81014c1de470a6c6f26051a2de32111b2ee55287feb" - url: "https://pub.dev" + sha256: accdaaa49a2aca2dc3c3230907988954cdd23fed0a19525d6c9789d380f4dc76 + url: "https://pub.flutter-io.cn" source: hosted - version: "3.14.0" + version: "3.9.4" win32: dependency: transitive description: name: win32 - sha256: "68d1e89a91ed61ad9c370f9f8b6effed9ae5e0ede22a270bdfa6daf79fc2290a" - url: "https://pub.dev" + sha256: "5a751eddf9db89b3e5f9d50c20ab8612296e4e8db69009788d6c8b060a84191c" + url: "https://pub.flutter-io.cn" source: hosted - version: "5.5.4" + version: "4.1.4" win32_registry: dependency: transitive description: name: win32_registry - sha256: "723b7f851e5724c55409bb3d5a32b203b3afe8587eaf5dafb93a5fed8ecda0d6" - url: "https://pub.dev" + sha256: "1c52f994bdccb77103a6231ad4ea331a244dbcef5d1f37d8462f713143b0bfae" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.4" + version: "1.1.0" window_manager: dependency: "direct main" description: name: window_manager - sha256: "8699323b30da4cdbe2aa2e7c9de567a6abd8a97d9a5c850a3c86dcd0b34bbfbf" - url: "https://pub.dev" + sha256: dcc865277f26a7dad263a47d0e405d77e21f12cb71f30333a52710a408690bd7 + url: "https://pub.flutter-io.cn" source: hosted - version: "0.3.9" + version: "0.3.7" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d - url: "https://pub.dev" + sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.4" + version: "1.0.3" xml: dependency: transitive description: name: xml - sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 - url: "https://pub.dev" + sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5" + url: "https://pub.flutter-io.cn" source: hosted - version: "6.5.0" + version: "6.2.2" yaml: dependency: transitive description: name: yaml sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.2" sdks: - dart: ">=3.5.0 <4.0.0" - flutter: ">=3.22.0" + dart: ">=2.19.6 <3.0.0" + flutter: ">=3.7.0" diff --git a/pubspec.yaml b/pubspec.yaml index 25ca67dc1..b097156c9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: none version: 1.9.48+380 environment: - sdk: ">=3.1.4" + sdk: ">=2.17.3 <3.0.0" dependencies: flutter: @@ -33,70 +33,135 @@ dependencies: url_launcher: ^6.3.0 bot_toast: ^4.1.3 package_info_plus: ^8.0.0 - mobx: ^2.3.3+2 - flutter_mobx: ^2.2.1+1 - in_app_purchase: ^3.2.0 + mobx: ^2.0.0 + flutter_mobx: ^2.0.0 + in_app_purchase: ^3.1.6 flutter_widget_from_html: ^0.15.2 device_info_plus: ^10.1.2 flutter_displaymode: ^0.6.0 - receive_sharing_intent: ^1.8.0 - cached_network_image: ^3.4.1 - flutter_cache_manager: ^3.4.1 + receive_sharing_intent: ^1.6.8 + cached_network_image: ^3.2.3 + flutter_cache_manager: ^3.3.0 waterfall_flow: ^3.0.3 - animations: ^2.0.11 - font_awesome_flutter: ^10.6.0 - json_annotation: ^4.9.0 + animations: ^2.0.8 + font_awesome_flutter: ^10.4.0 + json_annotation: ^4.8.1 flutter_staggered_animations: ^1.1.1 - badges: ^3.1.2 - image_picker: ^1.1.2 - intl: ^0.19.0 + badges: ^3.1.1 + image_picker: ^1.0.4 + intl: 0.17.0 quiver: ^3.2.2 flutter_inappwebview: ^6.0.0 auto_animated: ^3.1.0 - http: ^1.2.1 + http: ^0.13.6 dio_cache_interceptor: ^3.5.0 photo_view: ^0.15.0 - http_interceptor: ^2.0.0-beta.8 + http_interceptor: ^2.0.0-beta.5 image: ^4.2.0 - easy_refresh: ^3.4.0 - flutter_hooks: ^0.20.5 - hooks_riverpod: ^2.5.1 - sqflite: ^2.3.3+1 - dynamic_color: - git: - url: https://github.com/hasali19/material-foundation-flutter-packages.git - path: packages/dynamic_color - ref: main + easy_refresh: 3.3.0 + flutter_hooks: 0.18.3 + hooks_riverpod: any + sqflite: ^2.2.5 + dynamic_color: ^1.7.0 + # git: + # url: https://github.com/hasali19/material-foundation-flutter-packages.git + # path: packages/dynamic_color + # ref: main # Design Style - fluent_ui: ^4.8.7 + # fluent_ui: ^3.11.1 # Desktop Support flutter_acrylic: ^1.1.3 window_manager: ^0.3.7 - flutter_riverpod: ^2.5.1 - riverpod_annotation: ^2.3.5 - freezed_annotation: ^2.4.4 + flutter_riverpod: any + riverpod_annotation: any + freezed_annotation: ^2.4.1 dev_dependencies: flutter_test: sdk: flutter - build_runner: ^2.4.10 - mobx_codegen: ^2.6.1 - json_serializable: ^6.8.0 - analyzer: ^6.4.1 - sqflite_common_ffi: ^2.3.3 + build_runner: ^2.3.3 + mobx_codegen: ^2.0.0 + json_serializable: 6.6.2 + analyzer: ^5.2.0 + sqflite_common_ffi: ^2.2.5 msix: ^3.16.7 - riverpod_generator: ^2.4.0 - custom_lint: ^0.6.4 - riverpod_lint: ^2.3.10 - freezed: ^2.5.2 - webview_flutter_android: 3.16.1 + # riverpod_generator: ^2.4.0 + custom_lint: ^0.5.0 + # riverpod_lint: ^2.3.10 + # freezed: ^2.5.2 + # webview_flutter_android: 3.16.1 dependency_overrides: - flutter_inappwebview_ios: + # flutter_inappwebview_ios: + # git: + # url: https://github.com/andychucs/flutter_inappwebview.git + # ref: master + # path: flutter_inappwebview_ios + path_provider: + git: + url: https://gitee.com/openharmony-sig/flutter_packages.git + path: packages/path_provider/path_provider + path_provider_ohos: + git: + url: https://gitee.com/openharmony-sig/flutter_packages.git + path: packages/path_provider/path_provider_ohos + flutter_inappwebview: + git: + url: https://gitee.com/openharmony-sig/flutter_inappwebview.git + path: flutter_inappwebview + permission_handler: + git: + url: https://gitee.com/openharmony-sig/flutter_permission_handler.git + path: permission_handler + share_plus: + git: + url: https://gitee.com/openharmony-sig/flutter_plus_plugins.git + path: packages/share_plus/share_plus + battery_plus: + git: + url: https://gitee.com/openharmony-sig/flutter_plus_plugins.git + path: packages/battery_plus/battery_plus + url_launcher: + git: + url: https://gitee.com/openharmony-sig/flutter_packages.git + path: packages/url_launcher/url_launcher + shared_preferences: + git: + url: https://gitee.com/openharmony-sig/flutter_packages.git + path: packages/shared_preferences/shared_preferences + device_info_plus: git: - url: https://github.com/andychucs/flutter_inappwebview.git - ref: master - path: flutter_inappwebview_ios + url: https://gitee.com/openharmony-sig/flutter_plus_plugins.git + path: packages/device_info_plus/device_info_plus + package_info_plus: + git: + url: https://gitee.com/openharmony-sig/flutter_plus_plugins.git + path: packages/package_info_plus/package_info_plus + connectivity_plus: + git: + url: https://gitee.com/openharmony-sig/flutter_plus_plugins.git + path: packages/connectivity_plus/connectivity_plus + network_info_plus: + git: + url: https://gitee.com/openharmony-sig/flutter_plus_plugins.git + path: packages/network_info_plus/network_info_plus + file_selector: + git: + url: https://gitee.com/openharmony-sig/flutter_packages.git + path: packages/file_selector/file_selector + # webview_flutter: + # git: + # url: https://gitee.com/openharmony-sig/flutter_packages.git + # path: packages/webview_flutter/webview_flutter + image_picker: + git: + url: https://gitee.com/openharmony-sig/flutter_packages.git + path: packages/image_picker/image_picker + flutter_widget_from_html: + git: + url: https://gitee.com/openharmony-sig/flutter_widget_from_html + path: packages/enhanced + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec