About page

This commit is contained in:
LittleSheep 2024-06-08 13:28:49 +08:00
parent 78c0323908
commit e88a0ddb22
6 changed files with 80 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:solian/models/channel.dart'; import 'package:solian/models/channel.dart';
import 'package:solian/models/realm.dart'; import 'package:solian/models/realm.dart';
import 'package:solian/screens/about.dart';
import 'package:solian/screens/account.dart'; import 'package:solian/screens/account.dart';
import 'package:solian/screens/account/friend.dart'; import 'package:solian/screens/account/friend.dart';
import 'package:solian/screens/account/personalize.dart'; import 'package:solian/screens/account/personalize.dart';
@ -87,6 +88,11 @@ abstract class AppRouter {
name: 'accountPersonalize', name: 'accountPersonalize',
builder: (context, state) => const PersonalizeScreen(), builder: (context, state) => const PersonalizeScreen(),
), ),
GoRoute(
path: '/about',
name: 'about',
builder: (context, state) => const AboutScreen(),
),
], ],
), ),
ShellRoute( ShellRoute(

69
lib/screens/about.dart Normal file
View File

@ -0,0 +1,69 @@
import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:url_launcher/url_launcher_string.dart';
class AboutScreen extends StatelessWidget {
const AboutScreen({super.key});
@override
Widget build(BuildContext context) {
const denseButtonStyle =
ButtonStyle(visualDensity: VisualDensity(vertical: -4));
return Material(
color: Theme.of(context).colorScheme.surface,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset('assets/logo.png', width: 64, height: 64),
Text(
'Solian',
style: Theme.of(context).textTheme.headlineMedium,
),
const Text(
'The Solar Network',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
const SizedBox(height: 8),
FutureBuilder(
future: PackageInfo.fromPlatform(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return const SizedBox();
}
return Text(
'v${snapshot.data!.version} · ${snapshot.data!.buildNumber}',
style: const TextStyle(fontFamily: 'monospace'),
);
},
),
Text('Copyright © ${DateTime.now().year} Solsynth LLC'),
const SizedBox(height: 16),
TextButton(
style: denseButtonStyle,
child: const Text('More Information'),
onPressed: () {
launchUrlString('https://solsynth.dev/products/solar-network');
},
),
TextButton(
style: denseButtonStyle,
onPressed: () {
launchUrlString('https://solsynth.dev');
},
child: const Text('Official Website'),
),
const SizedBox(height: 16),
const Text(
'Open-sourced under AGPLv3',
style: TextStyle(
fontWeight: FontWeight.w300,
fontSize: 12,
),
),
],
),
);
}
}

View File

@ -24,6 +24,7 @@ class _AccountScreenState extends State<AccountScreen> {
'accountPersonalize' 'accountPersonalize'
), ),
(const Icon(Icons.diversity_1), 'accountFriend'.tr, 'accountFriend'), (const Icon(Icons.diversity_1), 'accountFriend'.tr, 'accountFriend'),
(const Icon(Icons.info_outline), 'about'.tr, 'about'),
]; ];
final AuthProvider provider = Get.find(); final AuthProvider provider = Get.find();

View File

@ -16,6 +16,7 @@ class SolianMessages extends Translations {
'confirm': 'Confirm', 'confirm': 'Confirm',
'leave': 'Leave', 'leave': 'Leave',
'loading': 'Loading...', 'loading': 'Loading...',
'about': 'About',
'edit': 'Edit', 'edit': 'Edit',
'delete': 'Delete', 'delete': 'Delete',
'search': 'Search', 'search': 'Search',
@ -199,7 +200,6 @@ class SolianMessages extends Translations {
'pushNotifyRegisterDone': 'Push notifications has been activated.', 'pushNotifyRegisterDone': 'Push notifications has been activated.',
'pushNotifyRegisterFailed': 'pushNotifyRegisterFailed':
'Unable to active push notification... @reason', 'Unable to active push notification... @reason',
'about': 'About',
}, },
'zh_CN': { 'zh_CN': {
'hide': '隐藏', 'hide': '隐藏',
@ -210,6 +210,7 @@ class SolianMessages extends Translations {
'confirm': '确认', 'confirm': '确认',
'leave': '离开', 'leave': '离开',
'loading': '载入中…', 'loading': '载入中…',
'about': '关于',
'edit': '编辑', 'edit': '编辑',
'delete': '删除', 'delete': '删除',
'page': '页面', 'page': '页面',
@ -384,7 +385,6 @@ class SolianMessages extends Translations {
'激活推送通知便可以让你在应用程序完全关闭的时候仍然获取到我们最新的通知。在 iOS/macOS 设备上我们使用 Apple 官方的推送服务;其他设备则通过 Google Firebase 提供推送通知。要注册推送通知设备,您可能需要连接到 Google 的服务器(在中国大陆不可用)并在您的设备上安装 Google Framework。即使您关闭此对话框下次启动应用程序时仍会自动执行此注册。', '激活推送通知便可以让你在应用程序完全关闭的时候仍然获取到我们最新的通知。在 iOS/macOS 设备上我们使用 Apple 官方的推送服务;其他设备则通过 Google Firebase 提供推送通知。要注册推送通知设备,您可能需要连接到 Google 的服务器(在中国大陆不可用)并在您的设备上安装 Google Framework。即使您关闭此对话框下次启动应用程序时仍会自动执行此注册。',
'pushNotifyRegisterDone': '推送通知已成功激活', 'pushNotifyRegisterDone': '推送通知已成功激活',
'pushNotifyRegisterFailed': '推送通知激活失败…… @reason', 'pushNotifyRegisterFailed': '推送通知激活失败…… @reason',
'about': '关于',
} }
}; };
} }

View File

@ -793,7 +793,7 @@ packages:
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
package_info_plus: package_info_plus:
dependency: transitive dependency: "direct main"
description: description:
name: package_info_plus name: package_info_plus
sha256: b93d8b4d624b4ea19b0a5a208b2d6eff06004bc3ce74c06040b120eeadd00ce0 sha256: b93d8b4d624b4ea19b0a5a208b2d6eff06004bc3ce74c06040b120eeadd00ce0

View File

@ -68,6 +68,7 @@ dependencies:
firebase_core: ^3.0.0 firebase_core: ^3.0.0
firebase_messaging: ^15.0.0 firebase_messaging: ^15.0.0
platform_device_id: ^1.0.1 platform_device_id: ^1.0.1
package_info_plus: ^8.0.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: