Skip to content

An open-source cross-platform alternative to AirDrop

feat: add about and changelog page

Tien Do Namca927d5cdf8f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 53fa514c..e085e308 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,3 @@
-## 1.0.0
+## 1.0.0 (2022)
- Initial Release
diff --git a/assets/i18n/strings.i18n.json b/assets/i18n/strings.i18n.json
index f46d89e6..91610ba2 100644
--- a/assets/i18n/strings.i18n.json
+++ b/assets/i18n/strings.i18n.json
@@ -96,6 +96,12 @@
"speed": "Speed: {speed}/s"
}
},
+ "aboutPage": {
+ "title": "About LocalSend"
+ },
+ "changelogPage": {
+ "title": "Changelog"
+ },
"dialogs": {
"cancelSession": {
"title": "Cancel file transfer",
diff --git a/assets/i18n/strings_de.i18n.json b/assets/i18n/strings_de.i18n.json
index a9bbaddd..03f44f3e 100644
--- a/assets/i18n/strings_de.i18n.json
+++ b/assets/i18n/strings_de.i18n.json
@@ -96,6 +96,12 @@
"speed": "Geschwindigkeit: {speed}/s"
}
},
+ "aboutPage": {
+ "title": "Über LocalSend"
+ },
+ "changelogPage": {
+ "title": "Changelog"
+ },
"dialogs": {
"cancelSession": {
"title": "Dateiübertragung abbrechen",
diff --git a/lib/pages/about_page.dart b/lib/pages/about_page.dart
new file mode 100644
index 00000000..0d09edd8
--- /dev/null
+++ b/lib/pages/about_page.dart
@@ -0,0 +1,66 @@
+import 'package:flutter/material.dart';
+import 'package:localsend_app/gen/strings.g.dart';
+import 'package:localsend_app/widget/local_send_logo.dart';
+import 'package:routerino/routerino.dart';
+import 'package:url_launcher/url_launcher.dart';
+
+final _body = '''
+ LocalSend is an open source app to share files and messages between nearby devices using the local wifi network.
+ There is no external server needed as the device itself is the server (peer-to-peer).
+
+ Currently, this app is available on Android and iOS. More platforms will follow soon.
+ '''.splitMapJoin(
+ RegExp(r'^', multiLine: true),
+ onMatch: (_) => '\n',
+ onNonMatch: (n) => n.trim(),
+);
+
+class AboutPage extends StatelessWidget {
+ const AboutPage();
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: Text(t.aboutPage.title),
+ ),
+ body: ListView(
+ padding: const EdgeInsets.symmetric(horizontal: 15),
+ children: [
+ const SizedBox(height: 20),
+ const LocalSendLogo(),
+ const SizedBox(height: 5),
+ Text(
+ '© ${DateTime.now().year} Tien Do Nam',
+ textAlign: TextAlign.center,
+ ),
+ const SizedBox(height: 10),
+ Text(_body),
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ TextButton(
+ onPressed: () {
+ launchUrl(Uri.parse('https://opensource.org/licenses/MIT'));
+ },
+ child: const Text('MIT License'),
+ ),
+ TextButton(
+ onPressed: () {
+ launchUrl(Uri.parse('https://github.com/localsend/localsend'), mode: LaunchMode.externalApplication);
+ },
+ child: const Text('Source Code (Github)'),
+ ),
+ TextButton(
+ onPressed: () {
+ context.push(() => const LicensePage());
+ },
+ child: const Text('License Notices'),
+ ),
+ ],
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/lib/pages/changelog_page.dart b/lib/pages/changelog_page.dart
new file mode 100644
index 00000000..7b299dc5
--- /dev/null
+++ b/lib/pages/changelog_page.dart
@@ -0,0 +1,28 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart' show rootBundle;
+import 'package:flutter_markdown/flutter_markdown.dart';
+import 'package:localsend_app/gen/strings.g.dart';
+
+class ChangelogPage extends StatelessWidget {
+ const ChangelogPage();
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: Text(t.changelogPage.title),
+ ),
+ body: FutureBuilder(
+ future: rootBundle.loadString('CHANGELOG.md'),
+ builder: (context, data) {
+ if (!data.hasData) {
+ return Container();
+ }
+ return Markdown(
+ data: data.data!,
+ );
+ }
+ ),
+ );
+ }
+}
diff --git a/lib/pages/tabs/settings_tab.dart b/lib/pages/tabs/settings_tab.dart
index 83daa877..2f10df75 100644
--- a/lib/pages/tabs/settings_tab.dart
+++ b/lib/pages/tabs/settings_tab.dart
@@ -1,13 +1,16 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
-import 'package:localsend_app/gen/assets.gen.dart';
import 'package:localsend_app/gen/strings.g.dart';
+import 'package:localsend_app/pages/about_page.dart';
+import 'package:localsend_app/pages/changelog_page.dart';
import 'package:localsend_app/provider/network/server_provider.dart';
import 'package:localsend_app/provider/settings_provider.dart';
import 'package:localsend_app/provider/version_provider.dart';
import 'package:localsend_app/theme.dart';
import 'package:localsend_app/util/sleep.dart';
import 'package:localsend_app/widget/custom_dropdown_button.dart';
+import 'package:localsend_app/widget/local_send_logo.dart';
+import 'package:routerino/routerino.dart';
class SettingsTab extends ConsumerStatefulWidget {
const SettingsTab({Key? key}) : super(key: key);
@@ -135,9 +138,9 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
IconButton(
onPressed: () async {
final newServerState = await ref.read(serverProvider.notifier).restartServer(
- alias: settings.alias,
- port: settings.port,
- );
+ alias: settings.alias,
+ port: settings.port,
+ );
if (newServerState != null) {
// the new state is always valid, so we can "repair" user's setting
@@ -188,29 +191,47 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
),
],
),
- const SizedBox(height: 20),
- Assets.img.logo512.image(
- width: 200,
- height: 200,
+ Align(
+ alignment: Alignment.centerLeft,
+ child: TextButton.icon(
+ style: TextButton.styleFrom(
+ foregroundColor: Theme.of(context).colorScheme.onSurface,
+ ),
+ onPressed: () {
+ context.push(() => const AboutPage());
+ },
+ icon: const Icon(Icons.info),
+ label: Text(t.aboutPage.title),
+ ),
),
- const Text(
- 'LocalSend',
- style: TextStyle(fontSize: 36, fontWeight: FontWeight.bold),
- textAlign: TextAlign.center,
+ Align(
+ alignment: Alignment.centerLeft,
+ child: TextButton.icon(
+ style: TextButton.styleFrom(
+ foregroundColor: Theme.of(context).colorScheme.onSurface,
+ ),
+ onPressed: () {
+ context.push(() => const ChangelogPage());
+ },
+ icon: const Icon(Icons.history),
+ label: Text(t.changelogPage.title),
+ ),
),
+ const SizedBox(height: 40),
+ const LocalSendLogo(),
const SizedBox(height: 5),
ref.watch(versionProvider).maybeWhen(
- data: (version) => Text(
- 'Version: $version',
- textAlign: TextAlign.center,
- ),
- orElse: () => Container(),
- ),
+ data: (version) => Text(
+ 'Version: $version',
+ textAlign: TextAlign.center,
+ ),
+ orElse: () => Container(),
+ ),
Text(
'© ${DateTime.now().year} Tien Do Nam',
textAlign: TextAlign.center,
),
- const SizedBox(height: 50),
+ const SizedBox(height: 80),
],
);
}
@@ -229,7 +250,7 @@ class _SettingsEntry extends StatelessWidget {
child: Row(
children: [
Expanded(
- child: Text(label, style: const TextStyle(fontSize: 16)),
+ child: Text(label),
),
SizedBox(
width: 150,
@@ -256,7 +277,7 @@ class _SettingsSection extends StatelessWidget {
padding: const EdgeInsets.only(bottom: 15),
child: Card(
child: Padding(
- padding: const EdgeInsets.only(left: 15, right: 15, top: 10),
+ padding: const EdgeInsets.only(left: 15, right: 15, top: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
diff --git a/lib/widget/local_send_logo.dart b/lib/widget/local_send_logo.dart
new file mode 100644
index 00000000..23016269
--- /dev/null
+++ b/lib/widget/local_send_logo.dart
@@ -0,0 +1,23 @@
+import 'package:flutter/material.dart';
+import 'package:localsend_app/gen/assets.gen.dart';
+
+class LocalSendLogo extends StatelessWidget {
+ const LocalSendLogo({Key? key}) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ return Column(
+ children: [
+ Assets.img.logo512.image(
+ width: 200,
+ height: 200,
+ ),
+ const Text(
+ 'LocalSend',
+ style: TextStyle(fontSize: 36, fontWeight: FontWeight.bold),
+ textAlign: TextAlign.center,
+ ),
+ ],
+ );
+ }
+}
diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc
index b7a6d08b..0cacc750 100644
--- a/linux/flutter/generated_plugin_registrant.cc
+++ b/linux/flutter/generated_plugin_registrant.cc
@@ -7,12 +7,16 @@
#include "generated_plugin_registrant.h"
#include <screen_retriever/screen_retriever_plugin.h>
+#include <url_launcher_linux/url_launcher_plugin.h>
#include <window_manager/window_manager_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
screen_retriever_plugin_register_with_registrar(screen_retriever_registrar);
+ g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
+ fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
+ url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
g_autoptr(FlPluginRegistrar) window_manager_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "WindowManagerPlugin");
window_manager_plugin_register_with_registrar(window_manager_registrar);
diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake
index 913ac71c..62f151fd 100644
--- a/linux/flutter/generated_plugins.cmake
+++ b/linux/flutter/generated_plugins.cmake
@@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
screen_retriever
+ url_launcher_linux
window_manager
)
diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift
index 20d068b3..e8a448b4 100644
--- a/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -11,6 +11,7 @@ import package_info_plus
import path_provider_macos
import screen_retriever
import shared_preferences_macos
+import url_launcher_macos
import window_manager
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
@@ -20,5 +21,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
+ UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))
}
diff --git a/pubspec.lock b/pubspec.lock
index e143d235..1abdb496 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -251,6 +251,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
+ flutter_markdown:
+ dependency: "direct main"
+ description:
+ name: flutter_markdown
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.6.13"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
@@ -417,6 +424,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
+ markdown:
+ dependency: transitive
+ description:
+ name: markdown
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "6.0.1"
matcher:
dependency: transitive
description:
@@ -800,6 +814,62 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
+ url_launcher:
+ dependency: "direct main"
+ description:
+ name: url_launcher
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "6.1.7"
+ url_launcher_android:
+ dependency: transitive
+ description:
+ name: url_launcher_android
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "6.0.22"
+ url_launcher_ios:
+ dependency: transitive
+ description:
+ name: url_launcher_ios
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "6.0.17"
+ url_launcher_linux:
+ dependency: transitive
+ description:
+ name: url_launcher_linux
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.0.1"
+ url_launcher_macos:
+ dependency: transitive
+ description:
+ name: url_launcher_macos
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.0.1"
+ url_launcher_platform_interface:
+ dependency: transitive
+ description:
+ name: url_launcher_platform_interface
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.1.1"
+ url_launcher_web:
+ dependency: transitive
+ description:
+ name: url_launcher_web
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.13"
+ url_launcher_windows:
+ dependency: transitive
+ description:
+ name: url_launcher_windows
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.0.1"
uuid:
dependency: "direct main"
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 888e3b14..42b7d9c8 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -15,6 +15,7 @@ dependencies:
file_picker: 5.2.4
flutter:
sdk: flutter
+ flutter_markdown: 0.6.13
flutter_riverpod: 2.1.1
freezed_annotation: 2.2.0
image_picker: 0.8.6
@@ -28,6 +29,7 @@ dependencies:
shelf_router: 1.1.3
slang: 3.7.0
slang_flutter: 3.7.0
+ url_launcher: 6.1.7
uuid: 3.0.7
window_manager: 0.2.8
@@ -43,4 +45,5 @@ flutter:
uses-material-design: true
assets:
- - assets/img/
\ No newline at end of file
+ - assets/img/
+ - CHANGELOG.md
\ No newline at end of file
diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc
index 1fdba3aa..f5e789c8 100644
--- a/windows/flutter/generated_plugin_registrant.cc
+++ b/windows/flutter/generated_plugin_registrant.cc
@@ -8,6 +8,7 @@
#include <network_info_plus/network_info_plus_windows_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h>
+#include <url_launcher_windows/url_launcher_windows.h>
#include <window_manager/window_manager_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
@@ -15,6 +16,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("NetworkInfoPlusWindowsPlugin"));
ScreenRetrieverPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenRetrieverPlugin"));
+ UrlLauncherWindowsRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("UrlLauncherWindows"));
WindowManagerPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("WindowManagerPlugin"));
}
diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake
index 21a1a359..eb6cef4e 100644
--- a/windows/flutter/generated_plugins.cmake
+++ b/windows/flutter/generated_plugins.cmake
@@ -5,6 +5,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
network_info_plus
screen_retriever
+ url_launcher_windows
window_manager
)