提交 2acb8417 authored 作者: yueweilu's avatar yueweilu

add

上级 371b60fb
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
...@@ -5,5 +5,6 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart'; ...@@ -5,5 +5,6 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import '../../utils/index.dart'; import '../../utils/index.dart';
import '../../widgets/index.dart';
part 'view.dart'; part 'view.dart';
\ No newline at end of file
...@@ -34,6 +34,12 @@ class _AnswerPageState extends State<AnswerPage> { ...@@ -34,6 +34,12 @@ 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();
});
}, },
onConsoleMessage: (controller, consoleMessage) { onConsoleMessage: (controller, consoleMessage) {
// 接收从 WebView 发送的消息 // 接收从 WebView 发送的消息
......
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;
// 输入框窗口是否展示 // 输入框窗口是否展示
...@@ -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 {
...@@ -710,6 +715,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -710,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';
......
...@@ -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,
......
...@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论