为了降低android studio的重量,我决定取消选中某些插件[我认为它们对于Flutter开发是不必要的]。
PLease为Flutter开发提供了有用且无用的插件列表。...
通过我想知道以下提到的插件是否有用?
1。kotlin插件对扑打有用吗? 2.Markdown支持插件 3.Markdown导航器插件 4.量规 5.Android APK支持 6.App链接助手 7.Android NDK支持 8,盖子 9,编辑器配置 10,谷歌云工具核心 11,用于Android Studio的Google云工具 Java的12.118n 13,时髦 14,Intellij配置脚本 15,intellilang 16.java字节码反编译器 17.java流调试器 第18章 19,科特林 20,商业整合 21.属性支持 22,设置库 23. smali支持 24.Sub版本 25.任务管理 26.测试记录仪 27.TestNG-J
答案 0 :(得分:0)
将您的html文件放入Web服务器,并将这些html文件加载为字符串
代码段
_loadHtmlFromAssets() async {
String url = 'http://test.com/Android/sample.html';
Response response = await get(url);
// sample info available in response
String fileText = response.body;
_controller.loadUrl( Uri.dataFromString(
fileText,
mimeType: 'text/html',
encoding: Encoding.getByName('utf-8')
).toString());
}
完整代码
import 'package:flutter/material.dart';
import 'dart:convert';
import 'package:flutter/services.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:http/http.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: HelpScreen(),
);
}
}
class HelpScreen extends StatefulWidget {
@override
HelpScreenState createState() {
return HelpScreenState();
}
}
class HelpScreenState extends State<HelpScreen> {
WebViewController _controller;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Help')),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
height: 300,
child: WebView(
initialUrl: '',
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController webViewController) {
_controller = webViewController;
},
),
),
IconButton(
icon: const Icon(
Icons.thumb_up,
semanticLabel: 'Thumbs up',
),
onPressed: () {
_loadHtmlFromAssets();
},
),
],
),
),
);
}
_loadHtmlFromAssets() async {
//String fileText = await rootBundle.loadString('assets/help.html');
String url = 'http://test.com/Android/sample.html';
Response response = await get(url);
// sample info available in response
String fileText = response.body;
_controller.loadUrl( Uri.dataFromString(
fileText,
mimeType: 'text/html',
encoding: Encoding.getByName('utf-8')
).toString());
}
}
演示