Skip to content

Commit

Permalink
add url launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
LiquidatorCoder2 committed Nov 13, 2021
1 parent d58c1e4 commit 52e6fe7
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 8 deletions.
22 changes: 14 additions & 8 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:odin/services/data_service.dart';
import 'package:odin/services/locator.dart';
import 'package:odin/widgets/window_top_bar.dart';
import 'package:url_launcher/url_launcher.dart';

const backgroundStartColor = Color(0x55121212);
const backgroundEndColor = Color(0x55202020);
Expand Down Expand Up @@ -69,14 +70,19 @@ class _HomePageState extends State<HomePage> {
? CircularProgressIndicator(
backgroundColor: Colors.white.withOpacity(0.3),
)
: Text(
_fileLink == null
? 'Drop a file to start'
: _fileLink.toString(),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w100,
color: Colors.white.withOpacity(0.3),
: GestureDetector(
onTap: _fileLink != null
? () => launch(_fileLink ?? '')
: null,
child: Text(
_fileLink == null
? 'Drop a file to start'
: _fileLink.toString(),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w100,
color: Colors.white.withOpacity(0.3),
),
),
),
),
Expand Down
54 changes: 54 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
get_it:
dependency: "direct main"
description:
Expand Down Expand Up @@ -179,6 +184,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
json_annotation:
dependency: transitive
description:
Expand Down Expand Up @@ -345,6 +357,48 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.12"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
vector_math:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies:
get_it: ^7.2.0
logger: ^1.1.0
path_provider: ^2.0.6
url_launcher: ^6.0.12

dev_dependencies:
flutter_test:
Expand Down
3 changes: 3 additions & 0 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <bitsdojo_window_windows/bitsdojo_window_plugin.h>
#include <desktop_drop/desktop_drop_plugin.h>
#include <flutter_acrylic/flutter_acrylic_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
BitsdojoWindowPluginRegisterWithRegistrar(
Expand All @@ -17,4 +18,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("DesktopDropPlugin"));
FlutterAcrylicPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterAcrylicPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
1 change: 1 addition & 0 deletions windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
bitsdojo_window_windows
desktop_drop
flutter_acrylic
url_launcher_windows
)

set(PLUGIN_BUNDLED_LIBRARIES)
Expand Down

0 comments on commit 52e6fe7

Please sign in to comment.