Browse Source

fix error

liuyuqi-dellpc 1 year ago
parent
commit
8ea3f1ce82

+ 1 - 0
android/app/build.gradle

@@ -56,4 +56,5 @@ flutter {
 
 dependencies {
     implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+    implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
 }

+ 8 - 0
android/app/src/main/AndroidManifest.xml

@@ -1,5 +1,13 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.example.shuqi">
+    
+  <uses-permission android:name="android.permission.INTERNET" />
+  <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
+  <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+  <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+  <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
+
    <application
         android:label="书旗小说"
         android:icon="@mipmap/ic_launcher">

+ 1 - 1
lib/app/app_scene.dart

@@ -1,6 +1,6 @@
 import 'package:flutter/material.dart';
 import 'package:shuqi/public.dart';
-import 'package:shuqi/app/index_page.dart';
+import 'package:shuqi/index_page.dart';
 
 final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
 

+ 0 - 0
lib/app/index_page.dart → lib/index_page.dart


+ 6 - 4
lib/pages/reader/battery_view.dart

@@ -1,8 +1,7 @@
 import 'package:flutter/material.dart';
-import 'package:battery/battery.dart';
 import 'package:device_info/device_info.dart';
 import 'dart:io';
-
+import 'package:battery_plus/battery_plus.dart';
 import 'package:shuqi/public.dart';
 
 class BatteryView extends StatefulWidget {
@@ -34,8 +33,11 @@ class _BatteryViewState extends State<BatteryView> {
         return;
       }
     }
-
-    var level = await Battery().batteryLevel;
+    var battery = Battery();
+    var level = await battery.batteryLevel;
+    battery.onBatteryStateChanged.listen((BatteryState state) {
+      // Do something with new state
+    });
     setState(() {
       this.batteryLevel = level / 100.0;
     });

+ 64 - 0
pubspec.lock

@@ -1,6 +1,14 @@
 # Generated by pub
 # See https://dart.dev/tools/pub/glossary#lockfile
 packages:
+  args:
+    dependency: transitive
+    description:
+      name: args
+      sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
+      url: "https://pub.flutter-io.cn"
+    source: hosted
+    version: "2.4.2"
   async:
     dependency: transitive
     description:
@@ -9,6 +17,22 @@ packages:
       url: "https://pub.flutter-io.cn"
     source: hosted
     version: "2.10.0"
+  battery_plus:
+    dependency: "direct main"
+    description:
+      name: battery_plus
+      sha256: e85c518029ae063666df860f57c41e5833d30a737316e7ef029cb3cfdc603e78
+      url: "https://pub.flutter-io.cn"
+    source: hosted
+    version: "4.0.2"
+  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:
@@ -81,6 +105,14 @@ packages:
       url: "https://pub.flutter-io.cn"
     source: hosted
     version: "3.0.3"
+  dbus:
+    dependency: transitive
+    description:
+      name: dbus
+      sha256: "6f07cba3f7b3448d42d015bfd3d53fe12e5b36da2423f23838efc1d5fb31a263"
+      url: "https://pub.flutter-io.cn"
+    source: hosted
+    version: "0.7.8"
   device_info:
     dependency: "direct main"
     description:
@@ -176,6 +208,14 @@ packages:
       url: "https://pub.flutter-io.cn"
     source: hosted
     version: "4.0.2"
+  intl:
+    dependency: "direct main"
+    description:
+      name: intl
+      sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
+      url: "https://pub.flutter-io.cn"
+    source: hosted
+    version: "0.18.1"
   js:
     dependency: transitive
     description:
@@ -280,6 +320,14 @@ packages:
       url: "https://pub.flutter-io.cn"
     source: hosted
     version: "2.2.1"
+  petitparser:
+    dependency: transitive
+    description:
+      name: petitparser
+      sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4"
+      url: "https://pub.flutter-io.cn"
+    source: hosted
+    version: "5.1.0"
   platform:
     dependency: transitive
     description:
@@ -461,6 +509,14 @@ packages:
       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"
   uuid:
     dependency: transitive
     description:
@@ -525,6 +581,14 @@ packages:
       url: "https://pub.flutter-io.cn"
     source: hosted
     version: "1.0.3"
+  xml:
+    dependency: transitive
+    description:
+      name: xml
+      sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5"
+      url: "https://pub.flutter-io.cn"
+    source: hosted
+    version: "6.2.2"
 sdks:
   dart: ">=2.19.0 <3.0.0"
   flutter: ">=3.7.0"

+ 2 - 2
pubspec.yaml

@@ -16,8 +16,8 @@ dependencies:
   webview_flutter: ^4.2.4
   share: ^2.0.4
   fluttertoast: ^8.2.2
-  battery:
-  intl:
+  battery_plus: ^4.0.2
+  intl: ^0.18.1
   device_info: ^2.0.3
 
 dev_dependencies: