You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
timemanager/lib/screen/about_screen.dart

94 lines
3.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// 导入需要使用的包同时在pubspec.yaml中添加依赖dependencies然后执行flutter pub get
// 类似于Java中的import语句python中的import语句pip install package_name
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:about/about.dart';
// 关于界面
class AboutScreen extends StatelessWidget {
const AboutScreen({Key? key}) : super(key: key);
// 每个界面都需要实现build方法返回一个Widget
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: PackageInfo.fromPlatform(),
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.hasData) {
final packageInfo = snapshot.data as PackageInfo;
String version = packageInfo.version;
String buildNumber = packageInfo.buildNumber;
return AboutPage(
key: const Key("aboutPage"),
// 页面的标签
title: Text("关于"),
// 控制显示图标
/* 所有要使用的资源需要在pubspec.yaml文件中的flutter节点下的assets节点声明否则无法访问资源 */
// FIXME: 此处APP图标显示异常
applicationIcon: SvgPicture.asset(
"icon.svg",
semanticsLabel: "Time Manager",
height: 100,
),
// 显示app版本号
applicationVersion: "v$version+$buildNumber",
// 显示app简介
applicationDescription: Text(
"一个也许能够管理你的时间的APP。",
textAlign: TextAlign.justify,
),
// 应用程序的版权信息
applicationLegalese:
"Copyright © 2023 中国民航大学 计算机科学与技术学院 \n 计算机科学与技术专业 21034102班 \n 庞浩,葛兴海,蔡玉祥,邹兴云,卫俊钢 小组",
/**
* 列表的每一项每一项都是一个ListTile
*/
children: <Widget>[
// 帮助文档
MarkdownPageListTile(
// TODO: 完善README文件中的内容
filename: 'README.md',
title: Text("帮助文档"),
icon: const Icon(FontAwesomeIcons.readme),
),
// 开发者信息
// FIXME: md文件中的链接无法跳转
MarkdownPageListTile(
filename: 'CONTRIBUTORS.md',
title: Text("开发者"),
icon: const Icon(FontAwesomeIcons.userAstronaut),
),
// 知士荟博客链接
ListTile(
leading: const Icon(FontAwesomeIcons.blog),
title: Text("知士荟博客"),
onTap: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text("请横屏查看"),
duration: Duration(seconds: 3)),
);
launchUrl(Uri.parse(
"https://www.learnerhub.net/#/users/12147/docs"));
}),
// 头歌源代码链接
ListTile(
leading: const Icon(FontAwesomeIcons.code),
title: Text("头歌源代码"),
onTap: () => launchUrl(Uri.parse(
"https://code.educoder.net/mbhvfy6mx/timemanager")),
),
],
);
} else {
return const Center(
child: CircularProgressIndicator(),
);
}
},
);
}
}