Skip to content

Commit 96e4c19

Browse files
committed
desktop: about: launch personal website on click
1 parent d7d00a0 commit 96e4c19

File tree

6 files changed

+76
-5
lines changed

6 files changed

+76
-5
lines changed

lib/screens/desktop/about.dart

+26-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:aflutter_craft/utils/utils.dart';
22
import 'package:flutter/material.dart';
33

44
import 'package:aflutter_craft/widgets/widgets.dart';
5+
import 'package:url_launcher/url_launcher.dart';
56

67
class About extends StatelessWidget {
78
About({Key? key}) : super(key: key);
@@ -96,11 +97,31 @@ class About extends StatelessWidget {
9697
},
9798
),
9899
SizedBox(height: 30),
99-
Text(
100-
"Copyright © Blacksuan19",
101-
style: TextStyle(
102-
color: Colors.grey[400],
103-
fontSize: 12,
100+
Text.rich(
101+
TextSpan(
102+
text: "Copyright © ",
103+
children: [
104+
WidgetSpan(
105+
child: InkWell(
106+
onTap: () async {
107+
await canLaunch(PER_SITE)
108+
? launch(PER_SITE)
109+
: throw "could not luanch $PER_SITE";
110+
},
111+
child: Text(
112+
"Blacksuan19",
113+
style: TextStyle(
114+
color: Colors.blue[200],
115+
fontSize: 12,
116+
),
117+
),
118+
),
119+
),
120+
],
121+
style: TextStyle(
122+
color: Colors.grey[400],
123+
fontSize: 12,
124+
),
104125
),
105126
)
106127
],

lib/utils/constants.dart

+2
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ Figure below shows the model architecture, attention module architecture and ide
2424
- Application -> Flutter
2525
2626
Figure below shows the overall process of styling an image.''';
27+
28+
const String PER_SITE = "https://blacksuan19.tk/";

linux/flutter/generated_plugin_registrant.cc

+4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55
#include "generated_plugin_registrant.h"
66

77
#include <file_selector_linux/file_selector_plugin.h>
8+
#include <url_launcher_linux/url_launcher_plugin.h>
89
#include <window_size/window_size_plugin.h>
910

1011
void fl_register_plugins(FlPluginRegistry* registry) {
1112
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
1213
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
1314
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
15+
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
16+
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
17+
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
1418
g_autoptr(FlPluginRegistrar) window_size_registrar =
1519
fl_plugin_registry_get_registrar_for_plugin(registry, "WindowSizePlugin");
1620
window_size_plugin_register_with_registrar(window_size_registrar);

linux/flutter/generated_plugins.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
list(APPEND FLUTTER_PLUGIN_LIST
66
file_selector_linux
7+
url_launcher_linux
78
window_size
89
)
910

pubspec.lock

+42
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,48 @@ packages:
434434
url: "https://pub.dartlang.org"
435435
source: hosted
436436
version: "1.3.0"
437+
url_launcher:
438+
dependency: "direct main"
439+
description:
440+
name: url_launcher
441+
url: "https://pub.dartlang.org"
442+
source: hosted
443+
version: "6.0.3"
444+
url_launcher_linux:
445+
dependency: transitive
446+
description:
447+
name: url_launcher_linux
448+
url: "https://pub.dartlang.org"
449+
source: hosted
450+
version: "2.0.0"
451+
url_launcher_macos:
452+
dependency: transitive
453+
description:
454+
name: url_launcher_macos
455+
url: "https://pub.dartlang.org"
456+
source: hosted
457+
version: "2.0.0"
458+
url_launcher_platform_interface:
459+
dependency: transitive
460+
description:
461+
name: url_launcher_platform_interface
462+
url: "https://pub.dartlang.org"
463+
source: hosted
464+
version: "2.0.2"
465+
url_launcher_web:
466+
dependency: transitive
467+
description:
468+
name: url_launcher_web
469+
url: "https://pub.dartlang.org"
470+
source: hosted
471+
version: "2.0.0"
472+
url_launcher_windows:
473+
dependency: transitive
474+
description:
475+
name: url_launcher_windows
476+
url: "https://pub.dartlang.org"
477+
source: hosted
478+
version: "2.0.0"
437479
uuid:
438480
dependency: transitive
439481
description:

pubspec.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ dependencies:
3838
social_share: any
3939
flutter_cache_manager: any
4040
path_provider: any
41+
url_launcher: any
4142
window_size:
4243
git:
4344
url: git://github.com/google/flutter-desktop-embedding.git

0 commit comments

Comments
 (0)