提交 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';
import 'package:go_router/go_router.dart';
import '../../utils/index.dart';
import '../../widgets/index.dart';
part 'view.dart';
\ No newline at end of file
......@@ -34,6 +34,12 @@ class _AnswerPageState extends State<AnswerPage> {
context.pop();
// 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) {
// 接收从 WebView 发送的消息
......
part of web;
class ReadController extends FullLifeCycleController with GetSingleTickerProviderStateMixin{
// 图书id
final String bookId;
// 章节id
String chapterId;
// 章节名称
String chapterName;
// 图书详细模型
final BookDetailModel bookDetailModel;
// 笔记id 用于我的笔记跳转阅读页对应位置
final String noteId;
ReadController({required this.bookId, required this.chapterId,required this.chapterName,required this.bookDetailModel,required this.noteId});
late InAppWebViewController webViewController;
// 目录
List <ChapterModel> chapters = [];
// 工具栏数组
List <ToolModel> tools = [
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: 2,name: '讨论',selected: false,icon: 'assets/images/discuss_unselect.png',activeIcon:'assets/images/discuss_select.png'),
];
// 默认工具栏选项
late ToolModel toolModel = tools.first;
// 输入框窗口是否展示
......@@ -74,23 +80,22 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
// 搜全文
List<SearchAllModel> searchALlResults = [];
// 刷新组件
final EasyRefreshController refreshController = EasyRefreshController(
controlFinishLoad: true,
controlFinishRefresh: true,
);
// 搜全文输入控制器
late TextEditingController searchInput = TextEditingController();
// 音频
just_audio.AudioPlayer audioPlayer = just_audio.AudioPlayer();
// 搜全文模型
late SearchAllModel sModel = SearchAllModel(bookId: '0');
// 本地文件地址
String localHtml5Path = '';
///------------------------------------------ 页面 生命周期--------------------------------------------------------
@override
void onInit() async {
......@@ -710,6 +715,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
final content = await readHtmlFileContent(toReadHtmlPath);
// 4、解密离线的内容
String htmlStr = EncryptUtil.aesDecrypt(content!);
// webViewController.evaluateJavascript(source: 'callbackInFlutterComponent($htmlStr);');
// 5、将离线内容写入临时文件
String directoryPath = path.dirname(toReadHtmlPath);
String writeFilePath = '$directoryPath/read.html';
......
......@@ -94,7 +94,7 @@ class _ReadPageState extends State<ReadPage> {
)
),
onWebViewCreated: (InAppWebViewController controller){
CustomToast.loading();
// CustomToast.loading();
readController.webViewController = controller;
},
onConsoleMessage: (controller, consoleMessage) {
......@@ -102,7 +102,7 @@ class _ReadPageState extends State<ReadPage> {
Console.log("Received message from WebView-----------------------------: ${consoleMessage.message}");
},
onLoadStop: (controller, url) {
CustomToast.dismiss();
// CustomToast.dismiss();
// flutter 主动给 js 传参数
Map<String, dynamic> param = {
'book_id': readController.bookId,
......
......@@ -16,7 +16,7 @@ class ReadOfflinePage extends StatefulWidget {
}) : super(key: key);
@override
State<ReadPage> createState() => _ReadPageState();
State<ReadPage> createState() => _ReadOfflinePageState();
}
class _ReadOfflinePageState extends State<ReadPage> {
......@@ -53,11 +53,7 @@ class _ReadOfflinePageState extends State<ReadPage> {
child: Stack(
children: [
InAppWebView(
initialUrlRequest:URLRequest(
// 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"),
),
initialFile: 'assets/html/read.html',
initialSettings:InAppWebViewSettings(
clearCache:true,
// http的请求也不做限制
......@@ -71,7 +67,6 @@ class _ReadOfflinePageState extends State<ReadPage> {
)
),
onWebViewCreated: (InAppWebViewController controller){
CustomToast.loading();
readController.webViewController = controller;
},
onConsoleMessage: (controller, consoleMessage) {
......@@ -79,13 +74,7 @@ class _ReadOfflinePageState extends State<ReadPage> {
Console.log("Received message from WebView-----------------------------: ${consoleMessage.message}");
},
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}';
Console.log('传给前端的参数--------------------------------$str');
controller.evaluateJavascript(source: 'callbackInFlutterComponent("$str");');
......
......@@ -184,7 +184,7 @@ abstract class AppTheme {
type: BottomNavigationBarType.fixed,
elevation: 0,
backgroundColor: Colors.white,
unselectedItemColor: scheme.onBackground.withOpacity(0.5),
unselectedItemColor: const Color(0xFF666666),
selectedItemColor: scheme.primary,
unselectedLabelStyle: TextStyle(fontSize: 11.w,fontWeight: Fonts.medium),
selectedLabelStyle: TextStyle(fontSize: 11.w,fontWeight: Fonts.medium),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论