From 679ed522d4a51906da2250aeba11c2072f873ad7 Mon Sep 17 00:00:00 2001 From: gexinghai <2874903098@qq.com> Date: Mon, 25 Sep 2023 10:54:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E6=AF=8F=E4=B8=AA=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E7=8B=AC=E7=AB=8B=E4=B8=BA=E4=B8=80=E4=B8=AA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 +-- lib/main.dart | 177 +----------------------------- lib/screens/about_screen.dart | 20 +++- lib/screens/course_screen.dart | 16 +++ lib/screens/dashboard_screen.dart | 107 ++++++++++++++++++ lib/screens/export_screen.dart | 16 +++ lib/screens/projects_screen.dart | 16 +++ lib/screens/reports_screen.dart | 16 +++ lib/screens/settings_screen.dart | 15 +++ 9 files changed, 208 insertions(+), 192 deletions(-) create mode 100644 lib/screens/course_screen.dart create mode 100644 lib/screens/dashboard_screen.dart create mode 100644 lib/screens/export_screen.dart create mode 100644 lib/screens/projects_screen.dart create mode 100644 lib/screens/reports_screen.dart create mode 100644 lib/screens/settings_screen.dart diff --git a/README.md b/README.md index 66de923..4bb03c3 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,3 @@ -# timemanage +# 时间管理 -A new Flutter project. - -## Getting Started - -This project is a starting point for a Flutter application. - -A few resources to get you started if this is your first Flutter project: - -- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) - -For help getting started with Flutter development, view the -[online documentation](https://docs.flutter.dev/), which offers tutorials, -samples, guidance on mobile development, and a full API reference. +一个基于Flutter框架的APP diff --git a/lib/main.dart b/lib/main.dart index 64248f3..99109ef 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:timemanage/screens/about_screen.dart'; +import 'package:timemanage/screens/dashboard_screen.dart'; void main() => runApp(const MyApp()); @@ -26,178 +26,3 @@ class MyApp extends StatelessWidget { ); } } - -class DashBoardScreen extends StatelessWidget { - const DashBoardScreen({super.key}); - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - backgroundColor: Colors.blueAccent, // 背景色 - // 最前面的菜单按钮 - leading: MenuBar( - children: [ - SubmenuButton( - menuChildren: [ - MenuItemButton( - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const CourseScreen()), - ); - }, - child: const Text('课程表'), - ), - MenuItemButton( - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const ProjectsScreen()), - ); - }, - child: const Text('项目'), - ), - MenuItemButton( - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const ReportsScreen()), - ); - }, - child: const Text('统计报告'), - ), - MenuItemButton( - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const ExportScreen()), - ); - }, - child: const Text('导入和导出'), - ), - MenuItemButton( - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const SettingsScreen()), - ); - }, - child: const Text('设置'), - ), - MenuItemButton( - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const AboutScreen()), - ); - }, - child: const Text('关于'), - ), - ], - child: const Icon(Icons.menu), - ), - ], - ), - // 标题 - title: const Text('时间管理'), - actions: [ - // 搜索按钮 - IconButton( - icon: const Icon(Icons.search), - onPressed: () {}, - ), - // 筛选按钮 - IconButton( - icon: const Icon(Icons.filter_alt), - onPressed: () {}, - ) - ], - ), - body: const Center( - child: Text('主界面'), - ), - ); - } -} - -class CourseScreen extends StatelessWidget { - const CourseScreen({super.key}); - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text('课程表'), - ), - body: const Center( - child: Text('课程表界面'), - ), - ); - } -} - -class ProjectsScreen extends StatelessWidget { - const ProjectsScreen({super.key}); - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text('项目'), - ), - body: const Center( - child: Text('项目界面'), - ), - ); - } -} - -class ReportsScreen extends StatelessWidget { - const ReportsScreen({super.key}); - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text('统计报告'), - ), - body: const Center( - child: Text('统计报告界面'), - ), - ); - } -} - -class ExportScreen extends StatelessWidget { - const ExportScreen({super.key}); - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text('导入与导出'), - ), - body: const Center( - child: Text('导入与导出界面'), - ), - ); - } -} - -class SettingsScreen extends StatelessWidget { - const SettingsScreen({super.key}); - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text('设置'), - ), - body: const Center( - child: Text('设置界面'), - ), - ); - } -} diff --git a/lib/screens/about_screen.dart b/lib/screens/about_screen.dart index 8027dfe..490a78f 100644 --- a/lib/screens/about_screen.dart +++ b/lib/screens/about_screen.dart @@ -1,3 +1,5 @@ +// 导入需要使用的包,同时在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'; @@ -5,8 +7,10 @@ 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( @@ -18,32 +22,45 @@ class AboutScreen extends StatelessWidget { 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: [ + // 帮助文档 MarkdownPageListTile( - // TODO: 补充两个markdown文件中的内容 + // 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("知士荟博客"), @@ -57,6 +74,7 @@ class AboutScreen extends StatelessWidget { launchUrl(Uri.parse( "https://www.learnerhub.net/#/users/12147/docs")); }), + // 头歌源代码链接 ListTile( leading: const Icon(FontAwesomeIcons.code), title: Text("头歌源代码"), diff --git a/lib/screens/course_screen.dart b/lib/screens/course_screen.dart new file mode 100644 index 0000000..6d66b1c --- /dev/null +++ b/lib/screens/course_screen.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; + +class CourseScreen extends StatelessWidget { + const CourseScreen({super.key}); + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('课程表'), + ), + body: const Center( + child: Text('课程表界面'), + ), + ); + } +} diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart new file mode 100644 index 0000000..bdf286e --- /dev/null +++ b/lib/screens/dashboard_screen.dart @@ -0,0 +1,107 @@ +import 'package:flutter/material.dart'; +import 'package:timemanage/screens/projects_screen.dart'; +import 'package:timemanage/screens/reports_screen.dart'; +import 'package:timemanage/screens/export_screen.dart'; +import 'package:timemanage/screens/settings_screen.dart'; +import 'package:timemanage/screens/about_screen.dart'; +import 'package:timemanage/screens/course_screen.dart'; + +class DashBoardScreen extends StatelessWidget { + const DashBoardScreen({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.blueAccent, // 背景色 + // 最前面的菜单按钮 + leading: MenuBar( + children: [ + SubmenuButton( + menuChildren: [ + MenuItemButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const CourseScreen()), + ); + }, + child: const Text('课程表'), + ), + MenuItemButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const ProjectsScreen()), + ); + }, + child: const Text('项目'), + ), + MenuItemButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const ReportsScreen()), + ); + }, + child: const Text('统计报告'), + ), + MenuItemButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const ExportScreen()), + ); + }, + child: const Text('导入和导出'), + ), + MenuItemButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const SettingsScreen()), + ); + }, + child: const Text('设置'), + ), + MenuItemButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const AboutScreen()), + ); + }, + child: const Text('关于'), + ), + ], + child: const Icon(Icons.menu), + ), + ], + ), + // 标题 + title: const Text('时间管理'), + actions: [ + // 搜索按钮 + IconButton( + icon: const Icon(Icons.search), + onPressed: () {}, + ), + // 筛选按钮 + IconButton( + icon: const Icon(Icons.filter_alt), + onPressed: () {}, + ) + ], + ), + body: const Center( + child: Text('主界面'), + ), + ); + } +} diff --git a/lib/screens/export_screen.dart b/lib/screens/export_screen.dart new file mode 100644 index 0000000..6c30674 --- /dev/null +++ b/lib/screens/export_screen.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; + +class ExportScreen extends StatelessWidget { + const ExportScreen({super.key}); + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('导入与导出'), + ), + body: const Center( + child: Text('导入与导出界面'), + ), + ); + } +} diff --git a/lib/screens/projects_screen.dart b/lib/screens/projects_screen.dart new file mode 100644 index 0000000..15e1650 --- /dev/null +++ b/lib/screens/projects_screen.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; + +class ProjectsScreen extends StatelessWidget { + const ProjectsScreen({super.key}); + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('项目'), + ), + body: const Center( + child: Text('项目界面'), + ), + ); + } +} diff --git a/lib/screens/reports_screen.dart b/lib/screens/reports_screen.dart new file mode 100644 index 0000000..e245c6a --- /dev/null +++ b/lib/screens/reports_screen.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; + +class ReportsScreen extends StatelessWidget { + const ReportsScreen({super.key}); + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('统计报告'), + ), + body: const Center( + child: Text('统计报告界面'), + ), + ); + } +} diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart new file mode 100644 index 0000000..99a3be1 --- /dev/null +++ b/lib/screens/settings_screen.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class SettingsScreen extends StatelessWidget { + const SettingsScreen({super.key}); + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('设置'), + ), + body: const Center( + child: Text('设置界面'), + )); + } +} -- 2.34.1