提交 3fee7a9e authored 作者: MrQi's avatar MrQi

README.md修改

上级 4726730d
...@@ -11,29 +11,81 @@ and the Flutter guide for ...@@ -11,29 +11,81 @@ and the Flutter guide for
[developing packages and plugins](https://flutter.dev/developing-packages). [developing packages and plugins](https://flutter.dev/developing-packages).
--> -->
TODO: Put a short description of the package here that helps potential users ## 开始使用
know whether this package might be useful for them.
## Features ```yaml
dependencies:
TODO: List what your package can do. Maybe include images, gifs, or videos. clx_webview_flutter:
git:
## Getting started url: https://t.clxkj.cn/openSourceLibrary/clx_webview_flutter.git
```
TODO: List prerequisites and provide or point to information on how to
start using the package.
## Usage ## Usage
TODO: Include short and useful examples for package users. Add longer examples ### 导入
to `/example` folder.
在使用之前,请确保您已经导入了`clx_webview_flutter`包。
```dart ```dart
const like = 'sample'; import 'package:clx_webview_flutter/clx_webview_flutter.dart';
``` ```
### 初始化
## Additional information #### loadRequest:在使用`CustomController`之前,您需要先初始化它。您可以通过调用`loadRequest`方法来加载一个请求。
```dart
final CustomController customController = CustomController.loadRequest(
requestedUrl: Uri.parse(uri), title: 'Captcha');
```
#### loadFile:如果您想加载一个本地html,您可以使用`loadFile`方法。
```dart
final CustomController customController = CustomController.loadFile(absoluteFilePath: 'c://path/to/your/file.html');
```
#### loadHtmlString:如果您想加载一个html字符串,您可以使用`loadHtmlString`方法。
```dart
final CustomController customController = CustomController.loadHtmlString(htmlString);
```
#### 添加JavaScript注入
```dart
Future<bool> setJavaScriptChannels(JavaScriptChannel channel)
```
#### 设置标题
```dart
Future<void> setTitle(String title)
```
#### 设置标题样式
```dart
Future<bool> setAppBarTextStyle(TextStyle? style)
```
### 使用
TODO: Tell users more about the package: where to find more information, how to #### 获取标题
contribute to the package, how to file issues, what response they can expect ```dart
from the package authors, and more. String title = customController.controller.getTitle();
```
#### 获取当前url
```dart
String currentUrl = customController.controller.getCurrentUrl();
```
#### 获取当前页面是否可以前进
```dart
bool canGoForward = customController.controller.canGoForward();
```
#### 获取当前页面是否可以后退
```dart
bool canGoBack = customController.controller.canGoBack();
```
#### 前进
```dart
customController.controller.goForward();
```
#### 后退
```dart
customController.controller.goBack();
```
#### 刷新
```dart
customController.controller.reload();
```
#### 加载url
```dart
customController.controller.loadUrl(url: Uri.parse('https://www.baidu.com'));
```
\ No newline at end of file
...@@ -15,7 +15,7 @@ class CustomController extends ChangeNotifier { ...@@ -15,7 +15,7 @@ class CustomController extends ChangeNotifier {
_controller.loadRequest(requestedUrl); _controller.loadRequest(requestedUrl);
} }
CustomController.loadFile( CustomController.loadHtmlString(
{required String html, {required String html,
String? baseUrl, String? baseUrl,
String? title, String? title,
...@@ -26,7 +26,7 @@ class CustomController extends ChangeNotifier { ...@@ -26,7 +26,7 @@ class CustomController extends ChangeNotifier {
_controller.loadHtmlString(html, baseUrl: baseUrl); _controller.loadHtmlString(html, baseUrl: baseUrl);
} }
CustomController.loadHtmlString({ CustomController.loadFile({
required String absoluteFilePath, required String absoluteFilePath,
String? title, String? title,
TextStyle? appBarTextStyle, TextStyle? appBarTextStyle,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论