pubspec.yaml 추가
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
hex: ^0.2.0
webview_flutter: ^4.0.2
flutter_inappwebview:
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'InAppWebView Example',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
late InAppWebViewController _webViewController;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('InAppWebView Example'),
),
body: InAppWebView(
initialUrlRequest: URLRequest(url: Uri.parse('https://naver.com')),
onWebViewCreated: (controller) {
_webViewController = controller;
},
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.refresh),
onPressed: () {
_webViewController.reload();
},
),
);
}
}
'프로그래밍 > flutter' 카테고리의 다른 글
flutter json -> object 로 변경 jsonDecode 사용 (0) | 2023.08.04 |
---|---|
flutter webview 에서 localhost:8080 에러발생시 net::ERR_CONNECTION_TIMED_OUT (0) | 2023.06.29 |
flutter webview 기본 샘플 (0) | 2023.06.29 |
flutter socket 연결후 데이타 계속 보내기 mymq 연결후 응답받음 (0) | 2023.06.28 |
flutter dart 에서 hexString 을 byte 로 변환 (소켓한번만연결) (0) | 2023.06.28 |