提交 838e9ddf authored 作者: 岳维路's avatar 岳维路

合并分支 'test' 到 'sim'

Test 查看合并请求 kiwitap/zijing-app!19
assets/images/2.0x/course.png

627 Bytes | W: | H:

assets/images/2.0x/course.png

627 Bytes | W: | H:

assets/images/2.0x/course.png
assets/images/2.0x/course.png
assets/images/2.0x/course.png
assets/images/2.0x/course.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/2.0x/library.png

409 Bytes | W: | H:

assets/images/2.0x/library.png

947 Bytes | W: | H:

assets/images/2.0x/library.png
assets/images/2.0x/library.png
assets/images/2.0x/library.png
assets/images/2.0x/library.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/2.0x/mine.png

795 Bytes | W: | H:

assets/images/2.0x/mine.png

776 Bytes | W: | H:

assets/images/2.0x/mine.png
assets/images/2.0x/mine.png
assets/images/2.0x/mine.png
assets/images/2.0x/mine.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/2.0x/shujia.png

1.7 KB | W: | H:

assets/images/2.0x/shujia.png

1.4 KB | W: | H:

assets/images/2.0x/shujia.png
assets/images/2.0x/shujia.png
assets/images/2.0x/shujia.png
assets/images/2.0x/shujia.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/3.0x/course.png

1.2 KB | W: | H:

assets/images/3.0x/course.png

1.1 KB | W: | H:

assets/images/3.0x/course.png
assets/images/3.0x/course.png
assets/images/3.0x/course.png
assets/images/3.0x/course.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/3.0x/library.png

615 Bytes | W: | H:

assets/images/3.0x/library.png

1.8 KB | W: | H:

assets/images/3.0x/library.png
assets/images/3.0x/library.png
assets/images/3.0x/library.png
assets/images/3.0x/library.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/3.0x/mine.png

1.5 KB | W: | H:

assets/images/3.0x/mine.png

1.5 KB | W: | H:

assets/images/3.0x/mine.png
assets/images/3.0x/mine.png
assets/images/3.0x/mine.png
assets/images/3.0x/mine.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/3.0x/shujia.png

3.2 KB | W: | H:

assets/images/3.0x/shujia.png

2.7 KB | W: | H:

assets/images/3.0x/shujia.png
assets/images/3.0x/shujia.png
assets/images/3.0x/shujia.png
assets/images/3.0x/shujia.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/course.png

386 Bytes | W: | H:

assets/images/course.png

374 Bytes | W: | H:

assets/images/course.png
assets/images/course.png
assets/images/course.png
assets/images/course.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/course_select.png

965 Bytes | W: | H:

assets/images/course_select.png

897 Bytes | W: | H:

assets/images/course_select.png
assets/images/course_select.png
assets/images/course_select.png
assets/images/course_select.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/library.png

273 Bytes | W: | H:

assets/images/library.png

521 Bytes | W: | H:

assets/images/library.png
assets/images/library.png
assets/images/library.png
assets/images/library.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/library_select.png

1.0 KB | W: | H:

assets/images/library_select.png

626 Bytes | W: | H:

assets/images/library_select.png
assets/images/library_select.png
assets/images/library_select.png
assets/images/library_select.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/mine.png

422 Bytes | W: | H:

assets/images/mine.png

424 Bytes | W: | H:

assets/images/mine.png
assets/images/mine.png
assets/images/mine.png
assets/images/mine.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/mine_select.png

910 Bytes | W: | H:

assets/images/mine_select.png

848 Bytes | W: | H:

assets/images/mine_select.png
assets/images/mine_select.png
assets/images/mine_select.png
assets/images/mine_select.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/shujia.png

786 Bytes | W: | H:

assets/images/shujia.png

705 Bytes | W: | H:

assets/images/shujia.png
assets/images/shujia.png
assets/images/shujia.png
assets/images/shujia.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/shujia_select.png

1.0 KB | W: | H:

assets/images/shujia_select.png

1009 Bytes | W: | H:

assets/images/shujia_select.png
assets/images/shujia_select.png
assets/images/shujia_select.png
assets/images/shujia_select.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -2,17 +2,6 @@ ...@@ -2,17 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
<key>NSPhotoLibraryUsageDescription</key>
<string>紫荆数智学堂请求在您使用期间获取您的相册权限以便更改用户头像或上传笔记</string>
<key>NSCameraUsageDescription</key>
<string>紫荆数智学堂需要使用相机权限进行拍照</string>
<key>CADisableMinimumFrameDurationOnPhone</key> <key>CADisableMinimumFrameDurationOnPhone</key>
<true/> <true/>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
...@@ -50,8 +39,23 @@ ...@@ -50,8 +39,23 @@
<string>$(FLUTTER_BUILD_NUMBER)</string> <string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
<key>NSAppleMusicUsageDescription</key>
<string>紫荆数智学堂需要访问媒体</string>
<key>NSCameraUsageDescription</key>
<string>紫荆数智学堂需要访问相机</string>
<key>NSMicrophoneUsageDescription</key> <key>NSMicrophoneUsageDescription</key>
<string>紫荆数智学堂需要使用麦克风进行录音</string> <string>紫荆数智学堂需要访问麦克风</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>紫荆数智学堂需要访问照片</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>紫荆数智学堂需要语言识别</string>
<key>UIApplicationSupportsIndirectInputEvents</key> <key>UIApplicationSupportsIndirectInputEvents</key>
<true/> <true/>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
...@@ -60,16 +64,9 @@ ...@@ -60,16 +64,9 @@
<string>Main</string> <string>Main</string>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
......
...@@ -3,7 +3,9 @@ library answer; ...@@ -3,7 +3,9 @@ library answer;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:get/get.dart';
import '../../utils/index.dart'; import '../../utils/index.dart';
import '../../widgets/index.dart';
part 'view.dart'; part 'view.dart';
...@@ -34,6 +34,18 @@ class _AnswerPageState extends State<AnswerPage> { ...@@ -34,6 +34,18 @@ class _AnswerPageState extends State<AnswerPage> {
context.pop(); context.pop();
// readController.titleInput.text = args.toString(); // readController.titleInput.text = args.toString();
}); });
controller.addJavaScriptHandler(handlerName: 'showLoadingCallback', callback: (args) async {
CustomToast.loading();
});
controller.addJavaScriptHandler(handlerName: 'dismissLoadingCallback', callback: (args) async {
CustomToast.dismiss();
});
// 答完题展示答题结果页
controller.addJavaScriptHandler(handlerName: 'submitSuccessCallback', callback: (args) async {
controller.loadUrl(urlRequest: URLRequest(
url: WebUri.uri(Uri.parse(kAnswerResult))
));
});
}, },
onConsoleMessage: (controller, consoleMessage) { onConsoleMessage: (controller, consoleMessage) {
// 接收从 WebView 发送的消息 // 接收从 WebView 发送的消息
......
...@@ -545,7 +545,7 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{ ...@@ -545,7 +545,7 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
_getModel.url!, _getModel.url!,
"zijing.apk", "zijing.apk",
"ic_launcher", "ic_launcher",
'https://itunes.apple.com/cn/app/抖音/id1142110895', 'https://apps.apple.com/us/app/%E7%B4%AB%E8%8D%86%E6%95%B0%E6%99%BA%E5%AD%A6%E5%A0%82/id6476735372',
); );
AzhonAppUpdate.update(model).then((value) => debugPrint('$value')); AzhonAppUpdate.update(model).then((value) => debugPrint('$value'));
} }
......
part of web; part of web;
class ReadController extends FullLifeCycleController with GetSingleTickerProviderStateMixin{ class ReadController extends FullLifeCycleController with GetSingleTickerProviderStateMixin{
// 图书id
final String bookId; final String bookId;
// 章节id
String chapterId; String chapterId;
// 章节名称
String chapterName; String chapterName;
// 图书详细模型
final BookDetailModel bookDetailModel; final BookDetailModel bookDetailModel;
// 笔记id 用于我的笔记跳转阅读页对应位置
final String noteId; final String noteId;
ReadController({required this.bookId, required this.chapterId,required this.chapterName,required this.bookDetailModel,required this.noteId}); ReadController({required this.bookId, required this.chapterId,required this.chapterName,required this.bookDetailModel,required this.noteId});
late InAppWebViewController webViewController; late InAppWebViewController webViewController;
// 目录 // 目录
List <ChapterModel> chapters = []; List <ChapterModel> chapters = [];
// 工具栏数组
List <ToolModel> tools = [ List <ToolModel> tools = [
ToolModel(tag: 0,name: '目录',selected: false,icon: 'assets/images/category_unselect.png',activeIcon: 'assets/images/category_select.png'), ToolModel(tag: 0,name: '目录',selected: false,icon: 'assets/images/category_unselect.png',activeIcon: 'assets/images/category_select.png'),
ToolModel(tag: 1,name: '笔记',selected: false,icon: 'assets/images/note_unselect.png',activeIcon:'assets/images/note_select.png'), ToolModel(tag: 1,name: '笔记',selected: false,icon: 'assets/images/note_unselect.png',activeIcon:'assets/images/note_select.png'),
ToolModel(tag: 2,name: '讨论',selected: false,icon: 'assets/images/discuss_unselect.png',activeIcon:'assets/images/discuss_select.png'), ToolModel(tag: 2,name: '讨论',selected: false,icon: 'assets/images/discuss_unselect.png',activeIcon:'assets/images/discuss_select.png'),
]; ];
// 默认工具栏选项
late ToolModel toolModel = tools.first; late ToolModel toolModel = tools.first;
// 输入框窗口是否展示 // 输入框窗口是否展示
...@@ -49,7 +55,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -49,7 +55,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
bool get show => _show; bool get show => _show;
// 录音 // 录音
FlutterSoundRecorder _mRecorder = FlutterSoundRecorder(logLevel:Level.error); final FlutterSoundRecorder _mRecorder = FlutterSoundRecorder(logLevel:Level.error);
// 录音开始 // 录音开始
bool startRecording = false; bool startRecording = false;
// 是否存在离线文件 // 是否存在离线文件
...@@ -74,23 +80,22 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -74,23 +80,22 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
// 搜全文 // 搜全文
List<SearchAllModel> searchALlResults = []; List<SearchAllModel> searchALlResults = [];
// 刷新组件
final EasyRefreshController refreshController = EasyRefreshController( final EasyRefreshController refreshController = EasyRefreshController(
controlFinishLoad: true, controlFinishLoad: true,
controlFinishRefresh: true, controlFinishRefresh: true,
); );
// 搜全文输入控制器
late TextEditingController searchInput = TextEditingController(); late TextEditingController searchInput = TextEditingController();
// 音频
just_audio.AudioPlayer audioPlayer = just_audio.AudioPlayer(); just_audio.AudioPlayer audioPlayer = just_audio.AudioPlayer();
// 搜全文模型
late SearchAllModel sModel = SearchAllModel(bookId: '0'); late SearchAllModel sModel = SearchAllModel(bookId: '0');
// 本地文件地址 // 本地文件地址
String localHtml5Path = ''; String localHtml5Path = '';
///------------------------------------------ 页面 生命周期-------------------------------------------------------- ///------------------------------------------ 页面 生命周期--------------------------------------------------------
@override @override
void onInit() async { void onInit() async {
...@@ -137,9 +142,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -137,9 +142,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
contentInput.dispose(); contentInput.dispose();
flutterTts.stop(); flutterTts.stop();
searchInput.dispose(); searchInput.dispose();
if (_mRecorder != null) {
_mRecorder.closeRecorder(); _mRecorder.closeRecorder();
}
// 关闭防截屏 // 关闭防截屏
// await ScreenProtector.preventScreenshotOff(); // await ScreenProtector.preventScreenshotOff();
super.onClose(); super.onClose();
...@@ -204,7 +207,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -204,7 +207,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
String htmlStr = EncryptUtil.aesDecrypt(content!); String htmlStr = EncryptUtil.aesDecrypt(content!);
Console.log('解密-----------------$htmlStr'); Console.log('解密-----------------$htmlStr');
Console.log('-------------使用本地文件-------------------'); Console.log('-------------使用本地文件-------------------');
webViewController.loadData(data: htmlStr??''); webViewController.loadData(data: htmlStr);
} }
...@@ -273,10 +276,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -273,10 +276,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
await flutterTts.setSpeechRate(0.5); await flutterTts.setSpeechRate(0.5);
await flutterTts.setPitch(1.0); await flutterTts.setPitch(1.0);
if (text != null) { if (text.isNotEmpty) {
if (text!.isNotEmpty) { await flutterTts.speak(text);
await flutterTts.speak(text!);
}
} }
} }
...@@ -338,9 +339,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -338,9 +339,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
final path = await _mRecorder.stopRecorder(); final path = await _mRecorder.stopRecorder();
Console.log('stopRecorder-----------path---------------------$path'); Console.log('stopRecorder-----------path---------------------$path');
if(path!=null && path.isNotEmpty){ if(path!=null && path.isNotEmpty){
var duration = await audioPlayer.setFilePath(path!); var duration = await audioPlayer.setFilePath(path);
Console.log('-----duration---------------------$duration------'); Console.log('-----duration---------------------$duration------');
AudioModel audioModel = AudioModel(path: path!,duration: Tools.formatDuration(duration!),currentDuration: '0:00:00'); AudioModel audioModel = AudioModel(path: path,duration: Tools.formatDuration(duration!),currentDuration: '0:00:00');
if(audioModel.duration !='0:00:00'){ if(audioModel.duration !='0:00:00'){
discussInputAudios.add(audioModel); discussInputAudios.add(audioModel);
} }
...@@ -663,7 +664,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -663,7 +664,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
} }
CustomToast.dismiss(); CustomToast.dismiss();
Toast.show('离线成功'); Toast.show('离线成功');
final exit = await _isExistFile(bookId); await _isExistFile(bookId);
update(); update();
} else { } else {
...@@ -714,6 +715,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -714,6 +715,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
final content = await readHtmlFileContent(toReadHtmlPath); final content = await readHtmlFileContent(toReadHtmlPath);
// 4、解密离线的内容 // 4、解密离线的内容
String htmlStr = EncryptUtil.aesDecrypt(content!); String htmlStr = EncryptUtil.aesDecrypt(content!);
// webViewController.evaluateJavascript(source: 'callbackInFlutterComponent($htmlStr);');
// 5、将离线内容写入临时文件 // 5、将离线内容写入临时文件
String directoryPath = path.dirname(toReadHtmlPath); String directoryPath = path.dirname(toReadHtmlPath);
String writeFilePath = '$directoryPath/read.html'; String writeFilePath = '$directoryPath/read.html';
...@@ -774,7 +778,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -774,7 +778,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
if (file is File && file.path.toLowerCase().endsWith('.html')) { if (file is File && file.path.toLowerCase().endsWith('.html')) {
String fileName = path.basenameWithoutExtension(file.path); String fileName = path.basenameWithoutExtension(file.path);
if (int.parse(fileName.split('-').first) == findIndex){ if (int.parse(fileName.split('-').first) == findIndex){
print('HTML File--------------------------------${file.path}'); Console.log('HTML File--------------------------------${file.path}');
toReadHtmlPath = file.path; toReadHtmlPath = file.path;
chapterId = fileName.split('-').last; chapterId = fileName.split('-').last;
chapterName = getChapterName(chapterId); chapterName = getChapterName(chapterId);
...@@ -784,7 +788,6 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -784,7 +788,6 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
} }
} }
// 开始读书 // 开始读书
read(toReadHtmlPath); read(toReadHtmlPath);
...@@ -884,7 +887,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -884,7 +887,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
ChapterModel? tModel = findChapterById(chapters, int.parse(chapterId)); ChapterModel? tModel = findChapterById(chapters, int.parse(chapterId));
if(tModel != null){ if(tModel != null){
updateParentsStatus(chapters, tModel!); updateParentsStatus(chapters, tModel);
} }
} }
...@@ -925,7 +928,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -925,7 +928,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
/// 添加阅读时长 /// 添加阅读时长
void _addReadTime({required type}) async{ void _addReadTime({required type}) async{
final result = await LibraryAPI.addReadTime(bookId: bookId, readTypes: type); LibraryAPI.addReadTime(bookId: bookId, readTypes: type);
} }
/// 获取离线文件路径 /// 获取离线文件路径
void getBookDown() async{ void getBookDown() async{
......
...@@ -94,7 +94,7 @@ class _ReadPageState extends State<ReadPage> { ...@@ -94,7 +94,7 @@ class _ReadPageState extends State<ReadPage> {
) )
), ),
onWebViewCreated: (InAppWebViewController controller){ onWebViewCreated: (InAppWebViewController controller){
CustomToast.loading(); // CustomToast.loading();
readController.webViewController = controller; readController.webViewController = controller;
}, },
onConsoleMessage: (controller, consoleMessage) { onConsoleMessage: (controller, consoleMessage) {
...@@ -102,7 +102,7 @@ class _ReadPageState extends State<ReadPage> { ...@@ -102,7 +102,7 @@ class _ReadPageState extends State<ReadPage> {
Console.log("Received message from WebView-----------------------------: ${consoleMessage.message}"); Console.log("Received message from WebView-----------------------------: ${consoleMessage.message}");
}, },
onLoadStop: (controller, url) { onLoadStop: (controller, url) {
CustomToast.dismiss(); // CustomToast.dismiss();
// flutter 主动给 js 传参数 // flutter 主动给 js 传参数
Map<String, dynamic> param = { Map<String, dynamic> param = {
'book_id': readController.bookId, 'book_id': readController.bookId,
...@@ -193,9 +193,8 @@ class _ReadPageState extends State<ReadPage> { ...@@ -193,9 +193,8 @@ class _ReadPageState extends State<ReadPage> {
'title':title 'title':title
}; };
Console.log('监听答题回调---------------给页面传参---------------------------------$params'); Console.log('监听答题回调---------------给页面传参---------------------------------$params');
context.pushNamed(Routes.answer,queryParameters: params);
// 跳转知识测评界面 // 跳转知识测评界面
context.pushNamed(Routes.answer,queryParameters: params);
}); });
...@@ -249,7 +248,7 @@ class _ReadPageState extends State<ReadPage> { ...@@ -249,7 +248,7 @@ class _ReadPageState extends State<ReadPage> {
context.pushNamed(Routes.scaleImage,queryParameters: params); context.pushNamed(Routes.scaleImage,queryParameters: params);
}); });
// 前端 token过回调 // 前端 token过回调
controller.addJavaScriptHandler(handlerName: 'refreshTokenCallback', callback: (args) async { controller.addJavaScriptHandler(handlerName: 'refreshTokenCallback', callback: (args) async {
final result = await readController.refreshToken(); final result = await readController.refreshToken();
Map<String, dynamic> param = { Map<String, dynamic> param = {
...@@ -258,7 +257,12 @@ class _ReadPageState extends State<ReadPage> { ...@@ -258,7 +257,12 @@ class _ReadPageState extends State<ReadPage> {
String jsonStr = jsonEncode(param); String jsonStr = jsonEncode(param);
controller.evaluateJavascript(source: 'refreshTokenSuccess($jsonStr)'); controller.evaluateJavascript(source: 'refreshTokenSuccess($jsonStr)');
}); });
controller.addJavaScriptHandler(handlerName: 'showLoadingCallback', callback: (args) async {
CustomToast.loading();
});
controller.addJavaScriptHandler(handlerName: 'dismissLoadingCallback', callback: (args) async {
CustomToast.dismiss();
});
/// 离线需要参数 /// 离线需要参数
// // // //
......
...@@ -16,7 +16,7 @@ class ReadOfflinePage extends StatefulWidget { ...@@ -16,7 +16,7 @@ class ReadOfflinePage extends StatefulWidget {
}) : super(key: key); }) : super(key: key);
@override @override
State<ReadPage> createState() => _ReadPageState(); State<ReadPage> createState() => _ReadOfflinePageState();
} }
class _ReadOfflinePageState extends State<ReadPage> { class _ReadOfflinePageState extends State<ReadPage> {
...@@ -53,11 +53,7 @@ class _ReadOfflinePageState extends State<ReadPage> { ...@@ -53,11 +53,7 @@ class _ReadOfflinePageState extends State<ReadPage> {
child: Stack( child: Stack(
children: [ children: [
InAppWebView( InAppWebView(
initialUrlRequest:URLRequest( initialFile: 'assets/html/read.html',
// url: Uri.parse(kReadBook),
url: readController.localHtml5Path.isNotEmpty?WebUri.uri(Uri.parse(readController.localHtml5Path)): WebUri.uri(Uri.parse(kReadBook))
// url: Uri.parse("/storage/emulated/0/Android/data/com.zijin.book.flutter_book/files/174/7-325.html"),
),
initialSettings:InAppWebViewSettings( initialSettings:InAppWebViewSettings(
clearCache:true, clearCache:true,
// http的请求也不做限制 // http的请求也不做限制
...@@ -71,7 +67,6 @@ class _ReadOfflinePageState extends State<ReadPage> { ...@@ -71,7 +67,6 @@ class _ReadOfflinePageState extends State<ReadPage> {
) )
), ),
onWebViewCreated: (InAppWebViewController controller){ onWebViewCreated: (InAppWebViewController controller){
CustomToast.loading();
readController.webViewController = controller; readController.webViewController = controller;
}, },
onConsoleMessage: (controller, consoleMessage) { onConsoleMessage: (controller, consoleMessage) {
...@@ -79,13 +74,7 @@ class _ReadOfflinePageState extends State<ReadPage> { ...@@ -79,13 +74,7 @@ class _ReadOfflinePageState extends State<ReadPage> {
Console.log("Received message from WebView-----------------------------: ${consoleMessage.message}"); Console.log("Received message from WebView-----------------------------: ${consoleMessage.message}");
}, },
onLoadStop: (controller, url) { onLoadStop: (controller, url) {
CustomToast.dismiss();
// flutter 主动给 js 传参数
Map<String, dynamic> param = {
'book_id': readController.bookId,
'chapter_id': readController.chapterId,
'token':UserStore.to.token
};
String str = '$kServerUrl,${readController.bookId},${readController.chapterId},${UserStore.to.token},${readController.noteId},${readController.sModel.bookId =='0'?'':readController.sModel.combinedContent}'; String str = '$kServerUrl,${readController.bookId},${readController.chapterId},${UserStore.to.token},${readController.noteId},${readController.sModel.bookId =='0'?'':readController.sModel.combinedContent}';
Console.log('传给前端的参数--------------------------------$str'); Console.log('传给前端的参数--------------------------------$str');
controller.evaluateJavascript(source: 'callbackInFlutterComponent("$str");'); controller.evaluateJavascript(source: 'callbackInFlutterComponent("$str");');
......
...@@ -184,7 +184,7 @@ abstract class AppTheme { ...@@ -184,7 +184,7 @@ abstract class AppTheme {
type: BottomNavigationBarType.fixed, type: BottomNavigationBarType.fixed,
elevation: 0, elevation: 0,
backgroundColor: Colors.white, backgroundColor: Colors.white,
unselectedItemColor: scheme.onBackground.withOpacity(0.5), unselectedItemColor: const Color(0xFF666666),
selectedItemColor: scheme.primary, selectedItemColor: scheme.primary,
unselectedLabelStyle: TextStyle(fontSize: 11.w,fontWeight: Fonts.medium), unselectedLabelStyle: TextStyle(fontSize: 11.w,fontWeight: Fonts.medium),
selectedLabelStyle: TextStyle(fontSize: 11.w,fontWeight: Fonts.medium), selectedLabelStyle: TextStyle(fontSize: 11.w,fontWeight: Fonts.medium),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论