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

README.md修改

上级 4726730d
......@@ -11,29 +11,81 @@ and the Flutter guide for
[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
TODO: List what your package can do. Maybe include images, gifs, or videos.
## Getting started
TODO: List prerequisites and provide or point to information on how to
start using the package.
```yaml
dependencies:
clx_webview_flutter:
git:
url: https://t.clxkj.cn/openSourceLibrary/clx_webview_flutter.git
```
## Usage
TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.
### 导入
在使用之前,请确保您已经导入了`clx_webview_flutter`包。
```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
from the package authors, and more.
#### 获取标题
```dart
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 {
_controller.loadRequest(requestedUrl);
}
CustomController.loadFile(
CustomController.loadHtmlString(
{required String html,
String? baseUrl,
String? title,
......@@ -26,7 +26,7 @@ class CustomController extends ChangeNotifier {
_controller.loadHtmlString(html, baseUrl: baseUrl);
}
CustomController.loadHtmlString({
CustomController.loadFile({
required String absoluteFilePath,
String? title,
TextStyle? appBarTextStyle,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论