diff --git a/lib/manager/my_connect.dart b/lib/manager/my_connect.dart index ab52656..90317ce 100644 --- a/lib/manager/my_connect.dart +++ b/lib/manager/my_connect.dart @@ -270,8 +270,7 @@ class MyConnect extends GetConnect { List contents = XPath.html(html).query(rule.chapterContent?.content ?? "").attrs; for (var element in contents) { - print(element); - content = "$content\n$element"; + content = "$content$element"; } content = content.replaceAll("  ", "\n  "); content = diff --git a/lib/pages/about/about_page.dart b/lib/pages/about/about_page.dart index a1699bd..d15377a 100644 --- a/lib/pages/about/about_page.dart +++ b/lib/pages/about/about_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:fun_reader/lang/keys.dart'; import 'package:fun_reader/routes/app_pages.dart'; import 'package:get/get.dart'; +import 'package:package_info_plus/package_info_plus.dart'; import 'package:url_launcher/url_launcher.dart'; /// @Author: gstory @@ -9,13 +10,33 @@ import 'package:url_launcher/url_launcher.dart'; /// @Email gstory0404@gmail.com /// @Description: dart类作用描述 -class AboutPage extends StatelessWidget { - const AboutPage({Key? key}) : super(key: key); - +class AboutPage extends StatefulWidget { static void go() { Get.toNamed(Routes.ABOUT); } + const AboutPage({Key? key}) : super(key: key); + + @override + State createState() => _AboutPageState(); +} + +class _AboutPageState extends State { + var version = ""; + + @override + void initState() { + super.initState(); + _getAppVersion(); + } + + Future _getAppVersion() async { + PackageInfo packageInfo = await PackageInfo.fromPlatform(); + setState(() { + version = "v${packageInfo.version}"; + }); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -26,7 +47,7 @@ class AboutPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( - margin: EdgeInsets.only(top: 100), + margin: const EdgeInsets.only(top: 100), child: Image.asset( "assets/images/logo.png", width: 80, @@ -34,10 +55,17 @@ class AboutPage extends StatelessWidget { ), ), Container( - margin: EdgeInsets.only(top: 30, bottom: 50), + margin: const EdgeInsets.only(top: 30), child: Text( Keys.appName.tr, - style: TextStyle(fontSize: 22, color: Colors.black), + style: const TextStyle(fontSize: 22, color: Colors.black), + ), + ), + Container( + margin: const EdgeInsets.only(top: 10, bottom: 50), + child: Text( + version, + style: const TextStyle(fontSize: 16, color: Colors.black), ), ), Expanded( @@ -62,8 +90,7 @@ class AboutPage extends StatelessWidget { children: const [ Text( "项目地址", - style: TextStyle( - fontSize: 16, color: Colors.black), + style: TextStyle(fontSize: 16, color: Colors.black), ), Icon(Icons.chevron_right), ], @@ -73,8 +100,8 @@ class AboutPage extends StatelessWidget { //书源规则 InkWell( onTap: () async { - await launchUrl( - Uri.parse("https://github.com/gstory0404/fun_reader/blob/master/rule.md")); + await launchUrl(Uri.parse( + "https://github.com/gstory0404/fun_reader/blob/master/rule.md")); }, child: Container( decoration: const BoxDecoration( @@ -89,8 +116,7 @@ class AboutPage extends StatelessWidget { children: const [ Text( "书源规则", - style: TextStyle( - fontSize: 16, color: Colors.black), + style: TextStyle(fontSize: 16, color: Colors.black), ), Icon(Icons.chevron_right), ], @@ -116,8 +142,7 @@ class AboutPage extends StatelessWidget { children: const [ Text( "开源协议", - style: TextStyle( - fontSize: 16, color: Colors.black), + style: TextStyle(fontSize: 16, color: Colors.black), ), Icon(Icons.chevron_right), ], diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 8d24c56..cb7f73e 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,7 @@ import FlutterMacOS import Foundation +import package_info_plus_macos import path_provider_macos import shared_preferences_macos import sqflite @@ -13,6 +14,7 @@ import url_launcher_macos import window_manager func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) diff --git a/pubspec.yaml b/pubspec.yaml index 26fc6af..71f3282 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -29,6 +29,7 @@ dependencies: file_picker: ^4.6.1 url_launcher: ^6.1.3 flutter_spinkit: ^5.1.0 + package_info_plus: ^1.4.2 dev_dependencies: flutter_test: