Android用のWebViewを追加。OSのブラウザは起動できないため。
This commit is contained in:
@ -44,6 +44,8 @@ PODS:
|
|||||||
- FMDB (>= 2.7.5)
|
- FMDB (>= 2.7.5)
|
||||||
- url_launcher_ios (0.0.1):
|
- url_launcher_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- webview_flutter_wkwebview (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
|
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
|
||||||
@ -64,6 +66,7 @@ DEPENDENCIES:
|
|||||||
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
|
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
|
||||||
- sqflite (from `.symlinks/plugins/sqflite/ios`)
|
- sqflite (from `.symlinks/plugins/sqflite/ios`)
|
||||||
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||||
|
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)
|
||||||
|
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
trunk:
|
trunk:
|
||||||
@ -108,6 +111,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/sqflite/ios"
|
:path: ".symlinks/plugins/sqflite/ios"
|
||||||
url_launcher_ios:
|
url_launcher_ios:
|
||||||
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||||
|
webview_flutter_wkwebview:
|
||||||
|
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
camera_avfoundation: 759172d1a77ae7be0de08fc104cfb79738b8a59e
|
camera_avfoundation: 759172d1a77ae7be0de08fc104cfb79738b8a59e
|
||||||
@ -131,6 +136,7 @@ SPEC CHECKSUMS:
|
|||||||
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
|
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
|
||||||
sqflite: 50a33e1d72bd59ee092a519a35d107502757ebed
|
sqflite: 50a33e1d72bd59ee092a519a35d107502757ebed
|
||||||
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
|
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
|
||||||
|
webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f
|
||||||
|
|
||||||
PODFILE CHECKSUM: 7a34d5e980f9e05ecf4e24c79da64ca020615638
|
PODFILE CHECKSUM: 7a34d5e980f9e05ecf4e24c79da64ca020615638
|
||||||
|
|
||||||
|
|||||||
21
lib/pages/WebView/WebView_page.dart
Normal file
21
lib/pages/WebView/WebView_page.dart
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:webview_flutter/webview_flutter.dart';
|
||||||
|
|
||||||
|
class WebViewPage extends StatelessWidget {
|
||||||
|
final String url;
|
||||||
|
|
||||||
|
const WebViewPage({Key? key, required this.url}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text('WebView'),
|
||||||
|
),
|
||||||
|
body: WebView(
|
||||||
|
initialUrl: url,
|
||||||
|
javascriptMode: JavascriptMode.unrestricted,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,6 +6,7 @@ import 'package:rogapp/routes/app_pages.dart';
|
|||||||
import 'package:rogapp/services/auth_service.dart';
|
import 'package:rogapp/services/auth_service.dart';
|
||||||
import 'package:rogapp/utils/database_helper.dart';
|
import 'package:rogapp/utils/database_helper.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
import 'package:rogapp/pages/WebView/WebView_page.dart';
|
||||||
|
|
||||||
// SafeAreaウィジェットを使用して、画面の安全領域内にメニューを表示しています。
|
// SafeAreaウィジェットを使用して、画面の安全領域内にメニューを表示しています。
|
||||||
// Columnウィジェットを使用して、メニューアイテムを縦に並べています。
|
// Columnウィジェットを使用して、メニューアイテムを縦に並べています。
|
||||||
@ -23,12 +24,26 @@ class DrawerPage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void _launchURL(String urlString) async {
|
void _launchURL(BuildContext context,String urlString) async {
|
||||||
Uri url = Uri.parse(urlString);
|
try {
|
||||||
if (await canLaunchUrl(url)) {
|
Uri url = Uri.parse(urlString);
|
||||||
await launchUrl(url);
|
if (await canLaunchUrl(url)) {
|
||||||
} else {
|
await launchUrl(url);
|
||||||
throw 'Could not launch $url';
|
} else {
|
||||||
|
// URLを開けない場合のフォールバック動作
|
||||||
|
// 例えば、WebViewを使用してアプリ内でURLを開く
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => WebViewPage(url: urlString),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}catch(e){
|
||||||
|
// エラーメッセージを表示する
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text('URLを開けませんでした: $e')),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +257,7 @@ class DrawerPage extends StatelessWidget {
|
|||||||
leading: const Icon(Icons.featured_video),
|
leading: const Icon(Icons.featured_video),
|
||||||
title: Text("rog_web".tr),
|
title: Text("rog_web".tr),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_launchURL("https://www.gifuai.net/?page_id=60043");
|
_launchURL(context, "https://www.gifuai.net/?page_id=60043");
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
: const SizedBox(
|
: const SizedBox(
|
||||||
@ -255,7 +270,7 @@ class DrawerPage extends StatelessWidget {
|
|||||||
leading: const Icon(Icons.privacy_tip),
|
leading: const Icon(Icons.privacy_tip),
|
||||||
title: Text("privacy".tr),
|
title: Text("privacy".tr),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_launchURL("https://rogaining.sumasen.net/api/privacy/");
|
_launchURL(context, "https://rogaining.sumasen.net/api/privacy/");
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
|
|||||||
32
pubspec.lock
32
pubspec.lock
@ -1389,6 +1389,38 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.5.1"
|
version: "0.5.1"
|
||||||
|
webview_flutter:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: webview_flutter
|
||||||
|
sha256: "392c1d83b70fe2495de3ea2c84531268d5b8de2de3f01086a53334d8b6030a88"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.4"
|
||||||
|
webview_flutter_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: webview_flutter_android
|
||||||
|
sha256: "8b3b2450e98876c70bfcead876d9390573b34b9418c19e28168b74f6cb252dbd"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.10.4"
|
||||||
|
webview_flutter_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: webview_flutter_platform_interface
|
||||||
|
sha256: "812165e4e34ca677bdfbfa58c01e33b27fd03ab5fa75b70832d4b7d4ca1fa8cf"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.9.5"
|
||||||
|
webview_flutter_wkwebview:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: webview_flutter_wkwebview
|
||||||
|
sha256: a5364369c758892aa487cbf59ea41d9edd10f9d9baf06a94e80f1bd1b4c7bbc0
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.9.5"
|
||||||
win32:
|
win32:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -87,6 +87,7 @@ dependencies:
|
|||||||
flutter_riverpod: ^2.5.1
|
flutter_riverpod: ^2.5.1
|
||||||
http: ^1.1.0
|
http: ^1.1.0
|
||||||
qr_code_scanner: ^1.0.1
|
qr_code_scanner: ^1.0.1
|
||||||
|
webview_flutter: ^3.0.0
|
||||||
|
|
||||||
flutter_icons:
|
flutter_icons:
|
||||||
android: true
|
android: true
|
||||||
|
|||||||
Reference in New Issue
Block a user