This repository was archived by the owner on Jun 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
247 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,31 @@ | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:sot_companion/modules/cook_time/pages/food_page.dart'; | ||
import 'package:sot_companion/modules/discord_rpc/pages/rpc.dart'; | ||
import 'package:sot_companion/modules/maps/pages/map.dart'; | ||
|
||
class Module { | ||
String name; | ||
String image; | ||
Widget mainPage; | ||
Size size; | ||
StatefulWidget mainPage; | ||
|
||
Module(this.name, this.image, this.mainPage); | ||
Module(this.name, this.image, this.size, this.mainPage); | ||
|
||
static List<Module> moduleList = [ | ||
Module( | ||
"Cuisine", | ||
"https://static.wikia.nocookie.net/seaofthieves_gamepedia/images/c/c6/Food.png/revision/latest/scale-to-width-down/1000?cb=20200116140939", | ||
Size(400, 100), | ||
CookTime_Page()), | ||
Module( | ||
"Discord_rpc", | ||
"https://discord.com/assets/9f6f9cd156ce35e2d94c0e62e3eff462.png", | ||
Size(400, 300), | ||
RPC_Page()), | ||
Module( | ||
"Maps", | ||
"https://static.wikia.nocookie.net/seaofthieves_gamepedia/images/5/5c/Treasure_Map_Icon.png/revision/latest/scale-to-width-down/125?cb=20200923101156", | ||
Size(400, 600), | ||
Map_Page()), | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:webview_windows/webview_windows.dart'; | ||
|
||
class SOT_WebviewManager { | ||
static final currentController = WebviewController(); | ||
|
||
static init() async{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:sot_companion/helper/WebviewManager.dart'; | ||
import 'package:webview_windows/webview_windows.dart'; | ||
|
||
import '../../../helper/WindowManager.dart'; | ||
|
||
class Map_Page extends StatefulWidget { | ||
Map_Page({Key? key}) : super(key: key); | ||
|
||
@override | ||
State<Map_Page> createState() => _Map_PageState(); | ||
} | ||
|
||
class _Map_PageState extends State<Map_Page> { | ||
final _controller = WebviewController(); | ||
bool ready = false; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
WidgetsBinding.instance.addPostFrameCallback((_) async { | ||
if (mounted) { | ||
initPlatformState(); | ||
} | ||
}); | ||
} | ||
|
||
Future<void> initPlatformState() async { | ||
// Optionally initialize the webview environment using | ||
// a custom user data directory | ||
// and/or a custom browser executable directory | ||
// and/or custom chromium command line flags | ||
//await WebviewController.initializeEnvironment( | ||
// additionalArguments: '--show-fps-counter'); | ||
|
||
try { | ||
await SOT_WebviewManager.currentController.initialize(); | ||
|
||
await SOT_WebviewManager.currentController | ||
.setBackgroundColor(Colors.transparent); | ||
await SOT_WebviewManager.currentController | ||
.setPopupWindowPolicy(WebviewPopupWindowPolicy.allow); | ||
await SOT_WebviewManager.currentController | ||
.loadUrl('https://maps.seaofthieves.rarethief.com/'); | ||
|
||
await SOT_WebviewManager.currentController.executeScript( | ||
"window.addEventListener('load', (event) => {document.body.style.width='100vw';document.body.style.height='100vh';document.body.style.overflow='hidden'});"); | ||
//await _controller.stop(); | ||
setState(() { | ||
ready = true; | ||
}); | ||
} on PlatformException catch (e) { | ||
print(e.toString()); | ||
} | ||
} | ||
|
||
Future<WebviewPermissionDecision> _onPermissionRequested( | ||
String url, WebviewPermissionKind kind, bool isUserInitiated) async { | ||
final decision = await showDialog<WebviewPermissionDecision>( | ||
context: context, | ||
builder: (BuildContext context) => AlertDialog( | ||
title: const Text('WebView permission requested'), | ||
content: Text('WebView has requested permission \'$kind\''), | ||
actions: <Widget>[ | ||
TextButton( | ||
onPressed: () => | ||
Navigator.pop(context, WebviewPermissionDecision.deny), | ||
child: const Text('Deny'), | ||
), | ||
TextButton( | ||
onPressed: () => | ||
Navigator.pop(context, WebviewPermissionDecision.allow), | ||
child: const Text('Allow'), | ||
), | ||
], | ||
), | ||
); | ||
|
||
return decision ?? WebviewPermissionDecision.none; | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
//SOT_WindowsManager.changeSize(const Size(400, 600)); | ||
|
||
return Column(children: [ | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Expanded(child: Container()), | ||
InkWell(child: | ||
CircleAvatar(backgroundImage: NetworkImage("https://cdn.discordapp.com/attachments/839604520245264404/993969738726260836/rare_thief.png")), | ||
onTap: ()async { | ||
await SOT_WebviewManager.currentController | ||
.loadUrl('https://maps.seaofthieves.rarethief.com/'); | ||
}, | ||
), | ||
Expanded(child: Container()), | ||
InkWell(child: | ||
CircleAvatar(backgroundImage: NetworkImage("https://cdn.discordapp.com/attachments/839604520245264404/993974389940965468/merfolks_lullaby.png")), | ||
onTap: ()async { | ||
await SOT_WebviewManager.currentController | ||
.loadUrl('https://www.merfolkslullaby.com/map?tab=weather'); | ||
}, | ||
), | ||
Expanded(child: Container()) | ||
]), | ||
ready | ||
? Expanded( | ||
child: Stack( | ||
children: [Webview(SOT_WebviewManager.currentController)], | ||
)) | ||
: Container()]); | ||
} | ||
} |
Oops, something went wrong.