From b4f04e5394cb236d434340d70ec8f5399def78af Mon Sep 17 00:00:00 2001 From: Lex Lim Date: Mon, 9 Jan 2023 13:37:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86json=E8=A7=A3=E6=9E=90=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=E4=B8=BAfreezed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/api/response/page_info.dart | 107 ++--- lib/api/response/parse.dart | 187 +++------ lib/api/response/recent_changes.dart | 59 +-- lib/api/response/userinfo.dart | 131 +++--- lib/main.dart | 3 +- lib/models/user.dart | 19 +- lib/pages/about.dart | 20 +- lib/pages/own_profile.dart | 86 ++-- lib/styles.dart | 16 +- lib/utils/dialog.dart | 36 +- macos/Flutter/GeneratedPluginRegistrant.swift | 2 + pubspec.lock | 373 ++++++++++-------- pubspec.yaml | 4 +- .../flutter/generated_plugin_registrant.cc | 3 + windows/flutter/generated_plugins.cmake | 1 + 15 files changed, 486 insertions(+), 561 deletions(-) diff --git a/lib/api/response/page_info.dart b/lib/api/response/page_info.dart index 263bf87..44722ad 100644 --- a/lib/api/response/page_info.dart +++ b/lib/api/response/page_info.dart @@ -1,53 +1,33 @@ -import 'package:json_annotation/json_annotation.dart'; +// ignore_for_file: invalid_annotation_target -part 'page_info.g.dart'; - -@JsonSerializable() -class PageInfo { - int pageid; - int ns; - String title; - String? displayTitle; - String? subtitle; - int? lastrevid; - String? contentmodel; - String? pagelanguage; - String? pagelanguagehtmlcode; - String? pagelanguagedir; - bool? inwatchlist; - - int? length; - String? fullurl; - String? editurl; - String? canonicalurl; +import 'package:freezed_annotation/freezed_annotation.dart'; - PageImageInfo? thumbnail; - - @JsonKey(name: "extract") - String? description; - - @JsonKey(name: "touched") - DateTime? updatedTime; +part 'page_info.freezed.dart'; +part 'page_info.g.dart'; - PageInfo({ - required this.pageid, - required this.ns, - required this.title, - this.subtitle, - this.displayTitle, - this.description, - this.contentmodel, - this.pagelanguage, - this.pagelanguagehtmlcode, - this.pagelanguagedir, - this.inwatchlist, - this.updatedTime, - this.lastrevid, - this.length, - this.fullurl, - this.editurl, - this.canonicalurl, - }); +@freezed +class PageInfo with _$PageInfo { + const PageInfo._(); + + factory PageInfo({ + required int pageid, + required int ns, + required String title, + String? subtitle, + String? displayTitle, + @JsonKey(name: "extract") String? description, + String? contentmodel, + String? pagelanguage, + String? pagelanguagehtmlcode, + String? pagelanguagedir, + bool? inwatchlist, + @JsonKey(name: "touched") DateTime? updatedTime, + int? lastrevid, + int? length, + String? fullurl, + String? editurl, + String? canonicalurl, + }) = _PageInfo; String get mainTitle { return displayTitle ?? title; @@ -57,34 +37,19 @@ class PageInfo { return null; } - factory PageInfo.fromJson(Map json) => - _$PageInfoFromJson(json); - - Map toJson() => _$PageInfoToJson(this); + factory PageInfo.fromJson(Map json) => _$PageInfoFromJson(json); } -@JsonSerializable() -class PagesResponse { - List pages; - - PagesResponse({required this.pages}); - - factory PagesResponse.fromJson(Map json) => - _$PagesResponseFromJson(json); +@freezed +class PagesResponse with _$PagesResponse { + factory PagesResponse({required List pages}) = _PageResponse; - Map toJson() => _$PagesResponseToJson(this); + factory PagesResponse.fromJson(Map json) => _$PagesResponseFromJson(json); } -@JsonSerializable() -class PageImageInfo { - String source; - int? width; - int? height; - - PageImageInfo({required this.source, this.width, this.height}); - - factory PageImageInfo.fromJson(Map json) => - _$PageImageInfoFromJson(json); +@freezed +class PageImageInfo with _$PageImageInfo { + factory PageImageInfo({required String source, int? width, int? height}) = _PageImageInfo; - Map toJson() => _$PageImageInfoToJson(this); + factory PageImageInfo.fromJson(Map json) => _$PageImageInfoFromJson(json); } diff --git a/lib/api/response/parse.dart b/lib/api/response/parse.dart index 8a63f25..519a288 100644 --- a/lib/api/response/parse.dart +++ b/lib/api/response/parse.dart @@ -1,149 +1,92 @@ -import 'package:json_annotation/json_annotation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +part 'parse.freezed.dart'; part 'parse.g.dart'; -@JsonSerializable() -class MWParseCategoryInfo { - String sortkey; - String category; - - MWParseCategoryInfo({ - required this.category, - this.sortkey = "", - }); +@freezed +class MWParseCategoryInfo with _$MWParseCategoryInfo { + factory MWParseCategoryInfo({ + required String category, + @Default("") String sortkey, + }) = _MWParseCategoryInfo; factory MWParseCategoryInfo.fromJson(Map json) => _$MWParseCategoryInfoFromJson(json); - - Map toJson() => _$MWParseCategoryInfoToJson(this); } -@JsonSerializable() -class MWParseLangLinkInfo { - String lang; - String url; - String langname; - String autonym; - String title; - - MWParseLangLinkInfo({ - required this.lang, - this.url = "", - this.langname = "", - this.autonym = "", - required this.title, - }); +@freezed +class MWParseLangLinkInfo with _$MWParseLangLinkInfo { + factory MWParseLangLinkInfo({ + required String lang, + required String title, + @Default("") String url, + @Default("") String langname, + @Default("") autonym, + }) = _MWParseLangLinkInfo; factory MWParseLangLinkInfo.fromJson(Map json) => _$MWParseLangLinkInfoFromJson(json); - - Map toJson() => _$MWParseLangLinkInfoToJson(this); } -@JsonSerializable() -class MWParsePageLinkInfo { - int ns; - String title; - bool exists; - - MWParsePageLinkInfo({ - required this.ns, - required this.title, - this.exists = false, - }); +@freezed +class MWParsePageLinkInfo with _$MWParsePageLinkInfo { + factory MWParsePageLinkInfo({ + required int ns, + required String title, + @Default(false) bool exists, + }) = _MWParsePageLinkInfo; factory MWParsePageLinkInfo.fromJson(Map json) => _$MWParsePageLinkInfoFromJson(json); - - Map toJson() => _$MWParsePageLinkInfoToJson(this); } -@JsonSerializable() -class MWParseSectionInfo { - int toclevel; - int level; - String line; - String number; - String index; - String fromtitle; - int? byteoffset; - String anchor; - - MWParseSectionInfo({ - this.toclevel = -1, - this.level = -1, - this.line = "", - this.number = "", - this.index = "", - this.fromtitle = "", - this.byteoffset, - this.anchor = "", - }); +@freezed +class MWParseSectionInfo with _$MWParseSectionInfo { + factory MWParseSectionInfo({ + required int toclevel, + required int level, + required String line, + @Default("") String number, + @Default("") String index, + @Default("") String fromtitle, + @Default(-1) int byteoffset, + @Default("") String anchor, + }) = _MWParseSectionInfo; factory MWParseSectionInfo.fromJson(Map json) => _$MWParseSectionInfoFromJson(json); - - Map toJson() => _$MWParseSectionInfoToJson(this); } -@JsonSerializable() -class MWParseInfo { - String title; - int pageid; - int revid; - String text; - List langlink; - List categories; - List links; - List templates; - List images; - List externallinks; - List sections; - bool showtoc; - String displaytitle; - List modules; - List modulescripts; - List modulestyles; - Map jsconfigvars; - Map iwlinks; - Map properties; - - MWParseInfo({ - required this.title, - required this.pageid, - this.revid = -1, - this.text = "", - this.langlink = const [], - this.categories = const [], - this.links = const [], - this.templates = const [], - this.images = const [], - this.externallinks = const [], - this.sections = const [], - this.showtoc = true, - this.displaytitle = "", - this.modules = const [], - this.modulescripts = const [], - this.modulestyles = const [], - this.jsconfigvars = const {}, - this.iwlinks = const {}, - this.properties = const {}, - }); - - factory MWParseInfo.fromJson(Map json) => - _$MWParseInfoFromJson(json); - - Map toJson() => _$MWParseInfoToJson(this); +@freezed +class MWParseInfo with _$MWParseInfo { + factory MWParseInfo({ + required String title, + required int pageid, + required int revid, + required String text, + String? displaytitle, + @Default([]) List langlink, + @Default([]) List categories, + @Default([]) List links, + @Default([]) List templates, + @Default([]) List images, + @Default([]) List externallinks, + @Default([]) List sections, + @Default(true) bool showtoc, + @Default([]) List modules, + @Default([]) List modulescripts, + @Default([]) List modulestyles, + @Default({}) Map jsconfigvars, + @Default({}) Map iwlinks, + @Default({}) Map properties, + }) = _MWParseInfo; + + factory MWParseInfo.fromJson(Map json) => _$MWParseInfoFromJson(json); } -@JsonSerializable() -class MWParseResponse { - MWParseInfo parse; - - MWParseResponse({required this.parse}); - - factory MWParseResponse.fromJson(Map json) => - _$MWParseResponseFromJson(json); +@freezed +class MWParseResponse with _$MWParseResponse { + factory MWParseResponse({required MWParseInfo parse}) = _MWParseResponse; - Map toJson() => _$MWParseResponseToJson(this); + factory MWParseResponse.fromJson(Map json) => _$MWParseResponseFromJson(json); } diff --git a/lib/api/response/recent_changes.dart b/lib/api/response/recent_changes.dart index cc180d3..b2a250c 100644 --- a/lib/api/response/recent_changes.dart +++ b/lib/api/response/recent_changes.dart @@ -1,51 +1,32 @@ -import 'package:json_annotation/json_annotation.dart'; +// ignore_for_file: invalid_annotation_target -part 'recent_changes.g.dart'; - -@JsonSerializable() -class RecentChangesItem { - String? type; - - int ns; - - String title; - - int pageid; - - int revid; +import 'package:freezed_annotation/freezed_annotation.dart'; - @JsonKey(name: 'old_revid') - int? oldRevid; - - int? rcid; - - DateTime timestamp; +part 'recent_changes.freezed.dart'; +part 'recent_changes.g.dart'; - RecentChangesItem({ - this.type, - required this.ns, - required this.title, - required this.pageid, - required this.revid, - this.oldRevid, - this.rcid, - required this.timestamp, - }); +@freezed +class RecentChangesItem with _$RecentChangesItem { + factory RecentChangesItem({ + String? type, + required int ns, + required String title, + required int pageid, + required int revid, + required DateTime timestamp, + @JsonKey(name: 'old_revid') int? oldRevid, + int? rcid, + }) = _RecentChangesItem; factory RecentChangesItem.fromJson(Map json) => _$RecentChangesItemFromJson(json); - - Map toJson() => _$RecentChangesItemToJson(this); } -@JsonSerializable() -class RecentChangesResponse { - List recentchanges; - - RecentChangesResponse({required this.recentchanges}); +@freezed +class RecentChangesResponse with _$RecentChangesResponse { + factory RecentChangesResponse({required List recentchanges}) = + _RecentChangesResponse; factory RecentChangesResponse.fromJson(Map json) => _$RecentChangesResponseFromJson(json); - - Map toJson() => _$RecentChangesResponseToJson(this); } diff --git a/lib/api/response/userinfo.dart b/lib/api/response/userinfo.dart index f390e50..8d0a0d9 100644 --- a/lib/api/response/userinfo.dart +++ b/lib/api/response/userinfo.dart @@ -1,101 +1,64 @@ -import 'package:json_annotation/json_annotation.dart'; +// ignore_for_file: invalid_annotation_target -part 'userinfo.g.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; -@JsonSerializable() -class UserGroupMembership { - String group; - String expiry; +part 'userinfo.freezed.dart'; +part 'userinfo.g.dart'; - UserGroupMembership({ - required this.group, - required this.expiry, - }); +@freezed +class UserGroupMembership with _$UserGroupMembership { + factory UserGroupMembership({ + required String group, + required String expiry, + }) = _UserGroupMembership; factory UserGroupMembership.fromJson(Map json) => _$UserGroupMembershipFromJson(json); - - Map toJson() => _$UserGroupMembershipToJson(this); } -@JsonSerializable() -class UserAcceptLang { - double q; - - @JsonKey(name: '*') - String langCode; - - UserAcceptLang({ - required this.q, - required this.langCode, - }); - - factory UserAcceptLang.fromJson(Map json) => - _$UserAcceptLangFromJson(json); +@freezed +class UserAcceptLang with _$UserAcceptLang { + factory UserAcceptLang({ + required double q, + @JsonKey(name: '*') required String langCode, + }) = _UserAcceptLang; - Map toJson() => _$UserAcceptLangToJson(this); + factory UserAcceptLang.fromJson(Map json) => _$UserAcceptLangFromJson(json); } -@JsonSerializable() -class MetaUserInfo { - int id; - String name; - List? groups; - List? groupmemberships; - List? implicitgroups; - List? rights; - Map>? changeablegroups; - Map? options; - int? editcount; - String? realname; - String? email; - DateTime? emailauthenticated; - DateTime? registrationdate; - List? acceptlang; - int? unreadcount; - Map? centralids; - Map? attachedlocal; - DateTime? latestcontrib; - - MetaUserInfo({ - required this.id, - required this.name, - this.groups, - this.groupmemberships, - this.implicitgroups, - this.rights, - this.changeablegroups, - this.options, - this.editcount, - this.realname, - this.email, - this.emailauthenticated, - this.registrationdate, - this.acceptlang, - this.unreadcount, - this.centralids, - this.attachedlocal, - this.latestcontrib, - }); - - factory MetaUserInfo.fromJson(Map json) => - _$MetaUserInfoFromJson(json); - - Map toJson() => _$MetaUserInfoToJson(this); +@freezed +class MetaUserInfo with _$MetaUserInfo { + factory MetaUserInfo({ + required int id, + required String name, + List? groups, + List? groupmemberships, + List? implicitgroups, + List? rights, + Map>? changeablegroups, + Map? options, + int? editcount, + String? realname, + String? email, + DateTime? emailauthenticated, + DateTime? registrationdate, + List? acceptlang, + int? unreadcount, + Map? centralids, + Map? attachedlocal, + DateTime? latestcontrib, + }) = _MetaUserInfo; + + factory MetaUserInfo.fromJson(Map json) => _$MetaUserInfoFromJson(json); } -@JsonSerializable() -class MetaUserInfoResponse { - MetaUserInfo userinfo; - Map? useravatar; - - MetaUserInfoResponse({ - required this.userinfo, - this.useravatar, - }); +@freezed +class MetaUserInfoResponse with _$MetaUserInfoResponse { + factory MetaUserInfoResponse({ + required MetaUserInfo userinfo, + Map? useravatar, + }) = _MetaUserInfoResponse; factory MetaUserInfoResponse.fromJson(Map json) => _$MetaUserInfoResponseFromJson(json); - - Map toJson() => _$MetaUserInfoResponseToJson(this); } diff --git a/lib/main.dart b/lib/main.dart index 3f8b744..6375a5e 100755 --- a/lib/main.dart +++ b/lib/main.dart @@ -4,9 +4,9 @@ import 'package:flutter/services.dart'; import 'package:flutter_displaymode/flutter_displaymode.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:get/get.dart'; +import 'package:get_storage/get_storage.dart'; import 'package:isekai_wiki/global.dart'; import 'package:isekai_wiki/models/lifecycle.dart'; -import 'package:isekai_wiki/models/user.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -25,6 +25,7 @@ Future init() async { } Global.sharedPreferences = await SharedPreferences.getInstance(); + await GetStorage.init(); } Future postInit() async { diff --git a/lib/models/user.dart b/lib/models/user.dart index ff12541..bbe2c99 100644 --- a/lib/models/user.dart +++ b/lib/models/user.dart @@ -9,6 +9,7 @@ import 'package:isekai_wiki/api/mw/mw_api.dart'; import 'package:isekai_wiki/api/mw/user.dart'; import 'package:isekai_wiki/api/response/mugenapp.dart'; import 'package:isekai_wiki/global.dart'; +import 'package:isekai_wiki/styles.dart'; import 'package:isekai_wiki/utils/dialog.dart'; import 'package:isekai_wiki/utils/error.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -29,8 +30,7 @@ class UserInfo { this.avatarUrlSet, }); - factory UserInfo.fromJson(Map json) => - _$UserInfoFromJson(json); + factory UserInfo.fromJson(Map json) => _$UserInfoFromJson(json); Map toJson() => _$UserInfoToJson(this); } @@ -52,7 +52,7 @@ class UserController extends GetxController { return userId.value > 0; } - String get getDisplayName { + String get displayName { return nickName.isNotEmpty ? nickName.string : userName.string; } @@ -179,18 +179,7 @@ class UserController extends GetxController { var startAuthInfo = startAuthRes.data; loginRequestToken.value = startAuthInfo.loginRequestKey; - await FlutterWebBrowser.openWebPage( - url: startAuthInfo.loginUrl, - customTabsOptions: const CustomTabsOptions( - defaultColorSchemeParams: CustomTabsColorSchemeParams( - toolbarColor: Color.fromRGBO(33, 37, 41, 1), - ), - shareState: CustomTabsShareState.off, - showTitle: true, - ), - safariVCOptions: const SafariViewControllerOptions( - barCollapsingEnabled: true, - )); + await openUrl(startAuthInfo.loginUrl, inApp: true); } catch (err, stack) { authProcessing.value = false; loginRequestToken.value = ""; diff --git a/lib/pages/about.dart b/lib/pages/about.dart index c1bcc9b..41e1087 100755 --- a/lib/pages/about.dart +++ b/lib/pages/about.dart @@ -1,8 +1,7 @@ import 'package:cupertino_lists/cupertino_lists.dart'; import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_web_browser/flutter_web_browser.dart'; import 'package:get/get.dart'; +import 'package:isekai_wiki/utils/dialog.dart'; import '../components/dummy_icon.dart'; import '../components/isekai_nav_bar.dart'; @@ -12,16 +11,7 @@ import '../styles.dart'; class AboutPageController extends GetxController { Future handleMainPageLinkClick() async { - if (GetPlatform.isAndroid || GetPlatform.isIOS) { - await FlutterWebBrowser.openWebPage( - url: Global.wikiHomeUrl, - customTabsOptions: const CustomTabsOptions( - defaultColorSchemeParams: CustomTabsColorSchemeParams( - toolbarColor: Colors.black87, - ), - ), - ); - } else {} + openUrl(Global.wikiHomeUrl); } } @@ -46,8 +36,7 @@ class AboutPage extends StatelessWidget { top: false, bottom: false, child: Padding( - padding: - const EdgeInsets.symmetric(horizontal: 12, vertical: 16), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16), child: Column( children: const [ Text("异世界百科APP", style: Styles.articleTitle), @@ -63,8 +52,7 @@ class AboutPage extends StatelessWidget { backgroundColor: Styles.themePageBackgroundColor, children: [ CupertinoListTile.notched( - title: const Text('异世界百科', - style: TextStyle(color: Styles.linkColor)), + title: const Text('异世界百科', style: TextStyle(color: Styles.linkColor)), leading: const DummyIcon( color: CupertinoColors.systemBlue, icon: CupertinoIcons.globe, diff --git a/lib/pages/own_profile.dart b/lib/pages/own_profile.dart index 7651d62..8cf027b 100755 --- a/lib/pages/own_profile.dart +++ b/lib/pages/own_profile.dart @@ -1,6 +1,8 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:cupertino_lists/cupertino_lists.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter_web_browser/flutter_web_browser.dart'; import 'package:get/get.dart'; import 'package:isekai_wiki/components/isekai_nav_bar.dart'; import 'package:isekai_wiki/models/user.dart'; @@ -20,13 +22,15 @@ class OwnProfileController extends GetxController { uc = Get.find(); } - Future handleLoginClick() { - if (uc.authProcessing.isFalse) { - handleStartAuth(); - return Future.delayed(const Duration(milliseconds: 100)); + Future handleUserClick() { + if (uc.isLoggedIn) { } else { - return Future.value(); + if (uc.authProcessing.isFalse) { + handleStartAuth(); + return Future.delayed(const Duration(milliseconds: 100)); + } } + return Future.value(); } Future handleStartAuth() async { @@ -63,8 +67,7 @@ class OwnProfileTab extends StatelessWidget { child: CachedNetworkImage( width: size, height: size, - placeholder: (_, __) => - const CupertinoActivityIndicator(radius: 12), + placeholder: (_, __) => const CupertinoActivityIndicator(radius: 12), imageUrl: avatarUrl, fit: BoxFit.cover, ), @@ -91,41 +94,27 @@ class OwnProfileTab extends StatelessWidget { dividerMargin: uc.isLoggedIn ? 14 : double.infinity, children: [ Obx( - () => uc.isLoggedIn - ? CupertinoListTile.notched( - title: Text(uc.getDisplayName, - style: Styles.listTileLargeTitle), - padding: const EdgeInsets.only( - left: 6, right: 14, top: 0, bottom: 0), - leading: _buildUserAvatar(uc), - leadingSize: 80, - leadingToTitle: 4, - trailing: const CupertinoListTileChevron(), - onTap: () {}, - ) - : CupertinoListTile.notched( - title: - const Text('登录/注册', style: Styles.listTileLargeTitle), - padding: const EdgeInsets.only( - left: 6, right: 14, top: 0, bottom: 0), - leading: const DummyIcon( - color: CupertinoColors.systemGrey, - icon: CupertinoIcons.person_fill, - size: 64, - rounded: true, - ), - leadingSize: 80, - leadingToTitle: 4, - trailing: uc.authProcessing.value - ? const Padding( - padding: EdgeInsets.only(right: 5), - child: CupertinoActivityIndicator( - radius: 12, - ), - ) - : const CupertinoListTileChevron(), - onTap: c.handleLoginClick, - ), + () => CupertinoListTile.notched( + title: uc.isLoggedIn + ? Text(uc.displayName, style: Styles.listTileLargeTitle) + : const Text('登录/注册', style: Styles.listTileLargeTitle), + subtitle: uc.isLoggedIn + ? Text("@${uc.userName.value}", style: Styles.listTileSubTitle) + : null, + padding: const EdgeInsets.only(left: 6, right: 14, top: 0, bottom: 0), + leading: _buildUserAvatar(uc), + leadingSize: 80, + leadingToTitle: 4, + trailing: uc.authProcessing.value + ? const Padding( + padding: EdgeInsets.only(right: 5), + child: CupertinoActivityIndicator( + radius: 12, + ), + ) + : const CupertinoListTileChevron(), + onTap: c.handleUserClick, + ), ), AnimatedSize( duration: const Duration(milliseconds: 250), @@ -214,12 +203,21 @@ class OwnProfileTab extends StatelessWidget { ); }, ), + if (kDebugMode) + CupertinoListTile.notched( + title: const Text('内部浏览器测试'), + leading: const DummyIcon( + color: CupertinoColors.systemBlue, + icon: CupertinoIcons.airplane, + ), + trailing: const CupertinoListTileChevron(), + onTap: () async {}, + ), ], )); } - SliverChildBuilderDelegate _buildSliverChildBuilderDelegate( - BuildContext context) { + SliverChildBuilderDelegate _buildSliverChildBuilderDelegate(BuildContext context) { return SliverChildBuilderDelegate( (context, index) { switch (index) { diff --git a/lib/styles.dart b/lib/styles.dart index d1345c8..5491042 100755 --- a/lib/styles.dart +++ b/lib/styles.dart @@ -6,14 +6,10 @@ abstract class Styles { static bool isXs = false; - static const CupertinoTextThemeData defaultTextTheme = - CupertinoTextThemeData(); + static const CupertinoTextThemeData defaultTextTheme = CupertinoTextThemeData(); static const TextStyle navLargeTitleTextStyle = TextStyle( - fontWeight: FontWeight.normal, - fontSize: 32, - color: CupertinoColors.label, - inherit: false); + fontWeight: FontWeight.normal, fontSize: 32, color: CupertinoColors.label, inherit: false); static const TextStyle productRowItemName = TextStyle( color: Color.fromRGBO(0, 0, 0, 0.8), @@ -43,18 +39,20 @@ abstract class Styles { static const TextStyle pageCardDescription = TextStyle( color: Colors.black54, - fontSize: 14, + fontSize: 16, fontStyle: FontStyle.normal, fontWeight: FontWeight.normal, ); static const TextStyle listTileLargeTitle = TextStyle(fontSize: 18); + static const TextStyle listTileSubTitle = TextStyle(fontSize: 16); + + static const Color websiteNavbarColor = Color.fromRGBO(33, 37, 41, 1); static const Color themeMainColor = Color.fromRGBO(65, 147, 135, 1); static const Color themeNavTitleColor = Color.fromRGBO(255, 255, 255, 1); static const Color themeBottomColor = Color.fromRGBO(255, 255, 255, 1); - static const Color themePageBackgroundColor = - Color.fromRGBO(240, 240, 240, 1); + static const Color themePageBackgroundColor = Color.fromRGBO(240, 240, 240, 1); static const Color themeNavSegmentTextColor = Color.fromRGBO(12, 12, 12, 1); static const Color panelBackgroundColor = Color.fromRGBO(255, 255, 255, 1); static const Color linkColor = CupertinoColors.link; diff --git a/lib/utils/dialog.dart b/lib/utils/dialog.dart index 15d9e89..4168554 100644 --- a/lib/utils/dialog.dart +++ b/lib/utils/dialog.dart @@ -1,5 +1,12 @@ import 'dart:async'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter_web_browser/flutter_web_browser.dart'; +import 'package:get/get.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'package:url_launcher/url_launcher_string.dart'; + +import '../styles.dart'; Future alert(BuildContext context, String content, {String? title}) { var c = Completer(); @@ -26,10 +33,7 @@ Future alert(BuildContext context, String content, {String? title}) { } Future confirm(BuildContext context, String content, - {String? title, - String? positiveText, - String? negativeText, - bool isDanger = false}) { + {String? title, String? positiveText, String? negativeText, bool isDanger = false}) { var c = Completer(); positiveText ??= "好"; @@ -63,3 +67,27 @@ Future confirm(BuildContext context, String content, return c.future; } + +Future openUrl(String url, {bool inApp = false}) async { + if (!kIsWeb && inApp) { + // APP部分 + if (GetPlatform.isAndroid || GetPlatform.isIOS) { + // 安卓和IOS使用应用内浏览器打开 + await FlutterWebBrowser.openWebPage( + url: url, + customTabsOptions: const CustomTabsOptions( + defaultColorSchemeParams: CustomTabsColorSchemeParams( + toolbarColor: Styles.websiteNavbarColor, + ), + shareState: CustomTabsShareState.off, + showTitle: true, + ), + safariVCOptions: const SafariViewControllerOptions( + barCollapsingEnabled: true, + )); + return; + } + } + // 其他平台直接调用浏览器打开 + launchUrlString(url); +} diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 240b101..fd4e5c0 100755 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -9,6 +9,7 @@ import package_info_plus import path_provider_macos import shared_preferences_macos import sqflite +import url_launcher_macos import wakelock_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { @@ -16,5 +17,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index ea5a0dc..963bfee 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,280 +5,280 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "50.0.0" analyzer: dependency: transitive description: name: analyzer - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "5.2.0" animations: dependency: "direct main" description: name: animations - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.7" args: dependency: transitive description: name: args - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.1" async: dependency: "direct main" description: name: async - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.9.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" build: dependency: transitive description: name: build - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.1" build_config: dependency: transitive description: name: build_config - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.1" build_daemon: dependency: transitive description: name: build_daemon - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.0" build_resolvers: dependency: transitive description: name: build_resolvers - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" build_runner: dependency: "direct dev" description: name: build_runner - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.3" build_runner_core: dependency: transitive description: name: build_runner_core - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "7.2.7" built_collection: dependency: transitive description: name: built_collection - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "5.1.1" built_value: dependency: transitive description: name: built_value - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "8.4.2" cached_network_image: dependency: "direct main" description: name: cached_network_image - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.3" cached_network_image_platform_interface: dependency: transitive description: name: cached_network_image_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" cached_network_image_web: dependency: transitive description: name: cached_network_image_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.2" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.1" checked_yaml: dependency: transitive description: name: checked_yaml - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.2" chewie: dependency: transitive description: name: chewie - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.6" chewie_audio: dependency: transitive description: name: chewie_audio - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.1" code_builder: dependency: transitive description: name: code_builder - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.4.0" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.16.0" convert: dependency: transitive description: name: convert - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.1" cookie_jar: dependency: transitive description: name: cookie_jar - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.1" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.2" csslib: dependency: transitive description: name: csslib - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.17.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.5" cupertino_lists: dependency: "direct main" description: name: cupertino_lists - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" dart_style: dependency: transitive description: name: dart_style - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.4" dio: dependency: "direct main" description: name: dio - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.0.6" dio_cache_interceptor: dependency: "direct main" description: name: dio_cache_interceptor - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.3.1" dio_cookie_manager: dependency: "direct main" description: name: dio_cookie_manager - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" dio_http2_adapter: dependency: "direct main" description: name: dio_http2_adapter - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" equatable: dependency: transitive description: name: equatable - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.5" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.1" ffi: dependency: transitive description: name: ffi - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.1" file: dependency: transitive description: name: file - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.1.4" fixnum: dependency: transitive description: name: fixnum - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" flutter: @@ -290,56 +290,56 @@ packages: dependency: transitive description: name: flutter_blurhash - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.7.0" flutter_cache_manager: dependency: transitive description: name: flutter_cache_manager - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.3.0" flutter_displaymode: dependency: "direct main" description: name: flutter_displaymode - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.2" flutter_hooks: dependency: transitive description: name: flutter_hooks - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.18.5+1" flutter_html: dependency: "direct main" description: name: flutter_html - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.1" flutter_inappwebview: dependency: "direct main" description: name: flutter_inappwebview - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "5.7.2+3" flutter_layout_grid: dependency: transitive description: name: flutter_layout_grid - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.6" flutter_lints: dependency: "direct dev" description: name: flutter_lints - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.1" flutter_localizations: @@ -351,21 +351,21 @@ packages: dependency: transitive description: name: flutter_math_fork - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.5.0" flutter_scale_tap: dependency: "direct main" description: name: flutter_scale_tap - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.5" flutter_svg: dependency: transitive description: name: flutter_svg - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.23.0+1" flutter_test: @@ -377,7 +377,7 @@ packages: dependency: "direct main" description: name: flutter_web_browser - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.17.1" flutter_web_plugins: @@ -389,448 +389,455 @@ packages: dependency: "direct dev" description: name: freezed - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.2" freezed_annotation: dependency: "direct main" description: name: freezed_annotation - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.0" frontend_server_client: dependency: transitive description: name: frontend_server_client - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.0" get: dependency: "direct main" description: name: get - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.6.5" + get_storage: + dependency: "direct main" + description: + name: get_storage + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.3" glob: dependency: transitive description: name: glob - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" graphs: dependency: transitive description: name: graphs - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.0" html: dependency: transitive description: name: html - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.15.1" http: dependency: transitive description: name: http - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.13.5" http2: dependency: "direct main" description: name: http2 - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.1" http_multi_server: dependency: transitive description: name: http_multi_server - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.1" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.0.2" intl: dependency: "direct main" description: name: intl - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.17.0" io: dependency: transitive description: name: io - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.3" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.6.4" json_annotation: dependency: "direct main" description: name: json_annotation - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.7.0" json_serializable: dependency: "direct dev" description: name: json_serializable - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.5.4" like_button: dependency: "direct main" description: name: like_button - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.5" lints: dependency: transitive description: name: lints - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.1" logging: dependency: transitive description: name: logging - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.12.12" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.5" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.8.0" mime: dependency: transitive description: name: mime - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.3" modal_bottom_sheet: dependency: "direct main" description: name: modal_bottom_sheet - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" nested: dependency: transitive description: name: nested - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" numerus: dependency: transitive description: name: numerus - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.1" octo_image: dependency: transitive description: name: octo_image - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.2" package_config: dependency: transitive description: name: package_config - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" package_info_plus: dependency: "direct main" description: name: package_info_plus - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.2" package_info_plus_platform_interface: dependency: transitive description: name: package_info_plus_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.1" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.8.2" path_drawing: dependency: transitive description: name: path_drawing - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.5.1+1" path_parsing: dependency: transitive description: name: path_parsing - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.1" path_provider: dependency: "direct main" description: name: path_provider - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.11" path_provider_android: dependency: transitive description: name: path_provider_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.22" path_provider_ios: dependency: transitive description: name: path_provider_ios - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.11" path_provider_linux: dependency: transitive description: name: path_provider_linux - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.7" path_provider_macos: dependency: transitive description: name: path_provider_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.6" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.5" path_provider_windows: dependency: transitive description: name: path_provider_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.3" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.11.1" petitparser: dependency: transitive description: name: petitparser - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "5.1.0" platform: dependency: transitive description: name: platform - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.3" pool: dependency: transitive description: name: pool - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.1" process: dependency: transitive description: name: process - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.2.4" provider: dependency: "direct main" description: name: provider - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.0.5" pub_semver: dependency: transitive description: name: pub_semver - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.3" pubspec_parse: dependency: transitive description: name: pubspec_parse - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.1" pull_down_button: dependency: "direct main" description: name: pull_down_button - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.1" quiver: dependency: transitive description: name: quiver - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.1" ruby_text: dependency: "direct main" description: name: ruby_text - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.1" rxdart: dependency: transitive description: name: rxdart - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.27.7" shared_preferences: dependency: "direct main" description: name: shared_preferences - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.15" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.14" shared_preferences_ios: dependency: transitive description: name: shared_preferences_ios - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" shared_preferences_macos: dependency: transitive description: name: shared_preferences_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.4" + version: "2.0.5" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.4" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" shelf: dependency: transitive description: name: shelf - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.4.0" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.3" skeletons: dependency: "direct main" description: name: skeletons - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.0.3" sky_engine: @@ -842,266 +849,322 @@ packages: dependency: transitive description: name: source_gen - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.6" source_helper: dependency: transitive description: name: source_helper - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.3" source_span: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.9.0" sqflite: dependency: transitive description: name: sqflite - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.2" sqflite_common: dependency: transitive description: name: sqflite_common - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.4.0+2" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" stream_transform: dependency: transitive description: name: stream_transform - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.1" synchronized: dependency: transitive description: name: synchronized - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0+3" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.12" timing: dependency: transitive description: name: timing - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" tuple: dependency: transitive description: name: tuple - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.1" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.1" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.1.7" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.0.22" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.0.17" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.1" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.1" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.13" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.1" uuid: dependency: transitive description: name: uuid - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.7" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" video_player: dependency: transitive description: name: video_player - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.4.10" video_player_android: dependency: transitive description: name: video_player_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.10" video_player_avfoundation: dependency: transitive description: name: video_player_avfoundation - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.8" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.0.1" video_player_web: dependency: transitive description: name: video_player_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.13" wakelock: dependency: transitive description: name: wakelock - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.6.2" wakelock_macos: dependency: transitive description: name: wakelock_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.0" wakelock_platform_interface: dependency: transitive description: name: wakelock_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.0" wakelock_web: dependency: transitive description: name: wakelock_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.0" wakelock_windows: dependency: transitive description: name: wakelock_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.1" watcher: dependency: transitive description: name: watcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.2" web_smooth_scroll: dependency: "direct main" description: name: web_smooth_scroll - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" web_socket_channel: dependency: transitive description: name: web_socket_channel - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.0" webview_flutter: dependency: transitive description: name: webview_flutter - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.8.0" webview_flutter_android: dependency: transitive description: name: webview_flutter_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.10.4" webview_flutter_platform_interface: dependency: transitive description: name: webview_flutter_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.9.5" webview_flutter_wkwebview: dependency: transitive description: name: webview_flutter_wkwebview - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.9.5" win32: dependency: transitive description: name: win32 - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.3" xdg_directories: dependency: transitive description: name: xdg_directories - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.0+2" xml: dependency: transitive description: name: xml - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "5.4.1" yaml: dependency: transitive description: name: yaml - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.1" sdks: diff --git a/pubspec.yaml b/pubspec.yaml index b6a263c..73c6cc8 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -48,6 +48,7 @@ dependencies: like_button: ^2.0.4 skeletons: ^0.0.3 modal_bottom_sheet: ^2.1.2 + url_launcher: ^6.1.7 flutter_web_browser: ^0.17.1 flutter_inappwebview: ^5.7.2+3 web_smooth_scroll: ^1.0.0 @@ -63,7 +64,8 @@ dependencies: dio_cookie_manager: ^2.0.0 dio_http2_adapter: ^2.0.0 dio_cache_interceptor: ^3.3.1 - get: + get: ^4.6.5 + get_storage: ^2.0.3 freezed_annotation: ^2.2.0 dev_dependencies: diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 8b6d468..4f78848 100755 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,9 @@ #include "generated_plugin_registrant.h" +#include void RegisterPlugins(flutter::PluginRegistry* registry) { + UrlLauncherWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index b93c4c3..88b22e5 100755 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + url_launcher_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST