Files
KiriMemo/lib/main.dart
T
pluv 1a48833914 chore: license the project under AGPL-3.0
- 添加官方 AGPL-3.0 全文
- LICENSE 作为 asset 打包,注册进 Flutter 许可清单
- 关于页「开源许可」改为打开许可页
- README 补充简介、开发命令与许可说明
2026-10-24 15:25:04 +08:00

61 lines
2.1 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/cupertino.dart' show CupertinoPageTransitionsBuilder;
import 'package:flutter/foundation.dart'
show LicenseEntryWithLineBreaks, LicenseRegistry;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'app_info.dart';
import 'app_shell.dart';
void main() {
_registerAppLicense();
runApp(const KiriMemoApp());
}
/// 把 LICENSE(AGPL-3.0)注册进 Flutter 的许可清单,
/// 这样「关于 → 开源许可」里会和应用依赖的许可显示在一起。
void _registerAppLicense() {
LicenseRegistry.addLicense(() async* {
final String text = await rootBundle.loadString('LICENSE');
yield LicenseEntryWithLineBreaks(<String>[appName], text);
});
}
class KiriMemoApp extends StatelessWidget {
const KiriMemoApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: appName,
debugShowCheckedModeBanner: false,
theme: _theme(Brightness.light),
darkTheme: _theme(Brightness.dark),
home: const AppShell(),
);
}
static ThemeData _theme(Brightness brightness) {
return ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: const Color(0xFF4C6EF5),
brightness: brightness,
),
// Flutter 3.47 起 Android 默认用 PredictiveBackPageTransitionsBuilder,
// 配合 targetSdk 36(Android 15+ 默认开启预测式返回)会在单路由外壳里
// 出现"预览走完直接退应用"的割裂感。这里显式换成无预测的 M3 水平
// 滑入转场(FadeForwards),同时 AndroidManifest 里关掉了
// enableOnBackInvokedCallback。
pageTransitionsTheme: const PageTransitionsTheme(
builders: <TargetPlatform, PageTransitionsBuilder>{
TargetPlatform.android: FadeForwardsPageTransitionsBuilder(),
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
TargetPlatform.macOS: CupertinoPageTransitionsBuilder(),
TargetPlatform.linux: FadeForwardsPageTransitionsBuilder(),
TargetPlatform.windows: FadeForwardsPageTransitionsBuilder(),
},
),
);
}
}