About page

This commit is contained in:
2025-09-13 02:26:35 +08:00
parent 2575803aa4
commit 3b315d26fa
11 changed files with 157 additions and 50 deletions

View File

@@ -17,19 +17,17 @@ class CalcApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: '方程计算器',
title: 'SimpleMathCalc',
theme: ThemeData(
primarySwatch: Colors.blue,
useMaterial3: true,
textTheme: GoogleFonts.notoSerifScTextTheme(
Theme.of(context).textTheme, // Inherit existing text theme
ThemeData().textTheme, // Inherit existing text theme
),
),
darkTheme: ThemeData.dark().copyWith(
primaryColor: Colors.blue,
textTheme: GoogleFonts.notoSerifScTextTheme(
Theme.of(context).textTheme,
),
textTheme: GoogleFonts.notoSerifScTextTheme(ThemeData.dark().textTheme),
),
themeMode: ThemeMode.system,
routerConfig: _router,

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class AboutPage extends StatelessWidget {
const AboutPage({super.key});
@@ -6,45 +7,79 @@ class AboutPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('About')),
body: Padding(
appBar: AppBar(title: const Text('关于')),
body: Center(
child: SingleChildScrollView(
padding: const EdgeInsets.all(16.0),
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 320),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 20),
Icon(
Icons.calculate,
size: 80,
color: Theme.of(context).colorScheme.primary,
Center(
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(8)),
child: Image.asset(
'assets/icon.jpg',
width: 80,
height: 80,
),
),
),
const SizedBox(height: 20),
Text(
'方程计算器',
'Simple Math Calc',
style: Theme.of(context).textTheme.headlineMedium,
textAlign: TextAlign.center,
),
const SizedBox(height: 10),
Text(
'Version 1.0.0',
'简单数学计算器',
style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.center,
),
const SizedBox(height: 20),
Text(
'这是一个用于求解方程和表达式的计算器应用。\n\n支持多种类型的数学计算,包括代数方程、表达式求值等。',
Opacity(
opacity: 0.8,
child: Text(
'这是一个用于求解方程和表达式的计算器应用。\n支持多种类型的数学计算,包括代数方程、表达式求值等。\n\n结果仅供参考,纯机器计算,无 AI 成分。\n\n在书写方程的时候,请勿使用中文符号,平方请使用 ^n 来表示 n 次方。\n\n理性使用,仅为辅助学习目的,过量使用有害考试成绩。',
style: Theme.of(context).textTheme.bodyMedium,
textAlign: TextAlign.center,
),
),
const SizedBox(height: 20),
Text(
'© 2025 LittleSheep',
style: Theme.of(context).textTheme.bodySmall,
textAlign: TextAlign.center,
),
const SizedBox(height: 30),
Text(
'© 2025 Simple Math Calculator',
style: Theme.of(context).textTheme.bodySmall,
'看看 LittleSheep 的其他作品',
style: Theme.of(context).textTheme.titleMedium,
textAlign: TextAlign.center,
),
const SizedBox(height: 16),
ListTile(
leading: const Icon(Icons.web),
trailing: const Icon(Icons.chevron_right),
title: const Text('Solar Network'),
subtitle: const Text('aka Solian'),
onTap: () => _launchUrl('https://web.solian.app'),
),
],
),
),
),
),
);
}
Future<void> _launchUrl(String url) async {
final Uri uri = Uri.parse(url);
if (!await launchUrl(uri)) {
throw Exception('Could not launch $url');
}
}
}

View File

@@ -74,6 +74,8 @@ class _CalculatorHomePageState extends State<CalculatorHomePage> {
hintText: '例如: 2x^2 - 8x + 6 = 0',
),
onSubmitted: (_) => _solveEquation(),
onTapOutside: (_) =>
FocusManager.instance.primaryFocus?.unfocus(),
),
),
IconButton(

View File

@@ -29,11 +29,8 @@ class _HomeScreenState extends State<HomeScreen> {
body: _widgetOptions.elementAt(_selectedIndex),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.calculate),
label: 'Calculator',
),
BottomNavigationBarItem(icon: Icon(Icons.info), label: 'About'),
BottomNavigationBarItem(icon: Icon(Icons.calculate), label: '计算'),
BottomNavigationBarItem(icon: Icon(Icons.info), label: '关于'),
],
currentIndex: _selectedIndex,
onTap: _onItemTapped,

View File

@@ -6,6 +6,10 @@
#include "generated_plugin_registrant.h"
#include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
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);
}

View File

@@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_linux
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST

View File

@@ -6,7 +6,9 @@ import FlutterMacOS
import Foundation
import path_provider_foundation
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}

View File

@@ -501,6 +501,70 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.2"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8
url: "https://pub.dev"
source: hosted
version: "6.3.2"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: "07cffecb7d68cbc6437cd803d5f11a86fe06736735c3dfe46ff73bcb0f958eed"
url: "https://pub.dev"
source: hosted
version: "6.3.21"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: d80b3f567a617cb923546034cc94bfe44eb15f989fe670b37f26abdb9d939cb7
url: "https://pub.dev"
source: hosted
version: "6.3.4"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935"
url: "https://pub.dev"
source: hosted
version: "3.2.1"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
sha256: c043a77d6600ac9c38300567f33ef12b0ef4f4783a2c1f00231d2b1941fea13f
url: "https://pub.dev"
source: hosted
version: "3.2.3"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
url: "https://pub.dev"
source: hosted
version: "2.3.2"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2"
url: "https://pub.dev"
source: hosted
version: "2.4.1"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77"
url: "https://pub.dev"
source: hosted
version: "3.1.4"
vector_graphics:
dependency: transitive
description:
@@ -575,4 +639,4 @@ packages:
version: "3.1.3"
sdks:
dart: ">=3.9.2 <4.0.0"
flutter: ">=3.29.0"
flutter: ">=3.35.0"

View File

@@ -38,6 +38,7 @@ dependencies:
latext: ^0.5.1
google_fonts: ^6.3.1
go_router: ^14.2.0
url_launcher: ^6.3.0
dev_dependencies:
flutter_test:
@@ -63,9 +64,8 @@ flutter:
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
assets:
- assets/icon.jpg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/to/resolution-aware-images

View File

@@ -6,6 +6,9 @@
#include "generated_plugin_registrant.h"
#include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}

View File

@@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_windows
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST