From ee14c6ea54fbce58d3d1c10b95ab2fbccd544c3d Mon Sep 17 00:00:00 2001 From: toly <1981462002@qq.com> Date: Tue, 16 Jun 2020 13:02:29 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=B7=BB=E5=8A=A0=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E7=89=88=E6=9C=AC=E6=A3=80=E6=9F=A5=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/app/res/cons.dart | 2 +- lib/app/router.dart | 4 + lib/app/style/NoScrollBehavior.dart | 11 ++ lib/views/pages/about/about_app_page.dart | 15 --- lib/views/pages/about/version_info.dart | 128 ++++++++++++++++++++++ lib/views/pages/home/home_drawer.dart | 2 +- lib/views/pages/home/home_page.dart | 2 +- lib/views/pages/setting/setting_page.dart | 11 +- 8 files changed, 156 insertions(+), 19 deletions(-) create mode 100644 lib/app/style/NoScrollBehavior.dart create mode 100644 lib/views/pages/about/version_info.dart diff --git a/lib/app/res/cons.dart b/lib/app/res/cons.dart index 1e89dfb..b288798 100644 --- a/lib/app/res/cons.dart +++ b/lib/app/res/cons.dart @@ -3,7 +3,7 @@ import 'package:flutter_unit/app/style/TolyIcon.dart'; import 'package:flutter_unit/components/permanent/code/highlighter_style.dart'; class Cons { - static String version = 'V1.1.0'; + static String version = 'V1.1.1'; static const MENU_INFO = ["关于", "帮助", "问题反馈"]; //菜单栏 static const ICONS_MAP = { diff --git a/lib/app/router.dart b/lib/app/router.dart index 6481e17..f72ffa5 100644 --- a/lib/app/router.dart +++ b/lib/app/router.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_unit/views/app/navigation/unit_navigation.dart'; import 'package:flutter_unit/views/pages/about/about_me_page.dart'; import 'package:flutter_unit/views/pages/about/about_app_page.dart'; +import 'package:flutter_unit/views/pages/about/version_info.dart'; import 'package:flutter_unit/views/pages/category/category_detail.dart'; import 'package:flutter_unit/views/pages/category/collect_page.dart'; import 'package:flutter_unit/views/pages/search/serach_page.dart'; @@ -34,6 +35,7 @@ class Router { static const String theme_color_setting = 'ThemeColorSettingPage'; static const String code_style_setting = 'CodeStyleSettingPage'; static const String item_style_setting = 'ItemStyleSettingPage'; + static const String version_info = 'VersionInfo'; static const String category_show = 'CategoryShow'; @@ -66,6 +68,8 @@ class Router { return Right2LeftRouter(child: CodeStyleSettingPage()); case item_style_setting: return Right2LeftRouter(child: ItemStyleSettingPage()); + case version_info: + return Right2LeftRouter(child: VersionInfo()); case attr: return Right2LeftRouter(child: AttrUnitPage()); diff --git a/lib/app/style/NoScrollBehavior.dart b/lib/app/style/NoScrollBehavior.dart new file mode 100644 index 0000000..84c4193 --- /dev/null +++ b/lib/app/style/NoScrollBehavior.dart @@ -0,0 +1,11 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/6/16 +/// contact me by email 1981462002@qq.com +/// 说明: + +class NoScrollBehavior extends ScrollBehavior { + @override + Widget buildViewportChrome( + BuildContext context, Widget child, AxisDirection axisDirection) => child; +} \ No newline at end of file diff --git a/lib/views/pages/about/about_app_page.dart b/lib/views/pages/about/about_app_page.dart index 54ec77a..7ada1ca 100644 --- a/lib/views/pages/about/about_app_page.dart +++ b/lib/views/pages/about/about_app_page.dart @@ -112,21 +112,6 @@ class AboutAppPage extends StatelessWidget { child: Wrap( spacing: 20, children: [ -// FeedbackWidget( -// onPressed: () => _launchURL( -// "https://juejin.im/user/5b42c0656fb9a04fe727eb37"), -// child: Wrap( -// direction: Axis.vertical, -// crossAxisAlignment: WrapCrossAlignment.center, -// children: [ -// Icon( -// TolyIcon.icon_juejin, -// size: 35, -// color: Colors.blue, -// ), -// Text('掘金') -// ], -// )), FeedbackWidget( onPressed: () => _launchURL("https://github.com/toly1994328/FlutterUnit"), diff --git a/lib/views/pages/about/version_info.dart b/lib/views/pages/about/version_info.dart new file mode 100644 index 0000000..6356bb1 --- /dev/null +++ b/lib/views/pages/about/version_info.dart @@ -0,0 +1,128 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_unit/app/res/cons.dart'; +import 'package:flutter_unit/app/router.dart'; +import 'package:flutter_unit/app/style/NoScrollBehavior.dart'; +import 'package:flutter_unit/components/permanent/circle_image.dart'; +import 'package:flutter_unit/components/permanent/feedback_widget.dart'; +import 'package:url_launcher/url_launcher.dart'; + +/// create by 张风捷特烈 on 2020/6/16 +/// contact me by email 1981462002@qq.com +/// 说明: + +class VersionInfo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBar( + backgroundColor: Colors.white, + elevation: 0, + iconTheme: IconThemeData( + color: Colors.grey + ), + ), + body:ConstrainedBox( + constraints: BoxConstraints.expand(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.only(top:28.0), + child: _buildTop(), + ), + + _buildCenter(context), + Spacer(), + Padding( + padding: const EdgeInsets.only(bottom:8.0), + child: buildBottom(), + ) + + ], + ), + ), + ); + } + + Widget _buildTop() { + return Wrap( + direction: Axis.vertical, + crossAxisAlignment: WrapCrossAlignment.center, + spacing: 10, + children: [ + CircleImage(image: AssetImage("assets/images/icon_head.png"),size: 80,), + Text('Flutter Unit',style: TextStyle(fontSize: 20,fontWeight: FontWeight.bold),), + Text('Version ${Cons.version}'), + ], + ); + } + + + + Widget _buildCenter(BuildContext context) { + final labelStyle= TextStyle(fontSize: 13); + return Padding( + padding: const EdgeInsets.only(left:20.0,right: 20,top: 20), + child: ScrollConfiguration( + behavior: NoScrollBehavior(), + child: ListView( + shrinkWrap: true, + children: [ + Divider(height: 1,), + ListTile( + title: Text('应用详情',style: labelStyle,), + trailing: _nextIcon(context), + onTap: () => Navigator.of(context).pushNamed(Router.about_app), + ), + Divider(height: 1,indent: 10), + ListTile( + title: Text('检查新版本',style: labelStyle), + trailing: _nextIcon(context), + onTap: () { + + }, + ), + Divider(height: 1,indent: 10), + ListTile( + title: Text('检查数据库新版本',style: labelStyle), + trailing: _nextIcon(context), + onTap: () { + + }, + ), + Divider(height: 1,), + ], + ), + ), + ); + } + + Widget _nextIcon(BuildContext context) => + Icon(Icons.chevron_right, color: Colors.grey); + + Widget buildBottom() { + return Wrap( + direction: Axis.vertical, + crossAxisAlignment: WrapCrossAlignment.center, + spacing: 4, + children: [ + FeedbackWidget( + onPressed: (){ + _launchURL("https://github.com/toly1994328/FlutterUnit"); + }, + child: Text('《查看本项目Github仓库》',style: TextStyle(fontSize: 12,color: Color(0xff616C84),),)), + Text('Power By 张风捷特烈',style: TextStyle(fontSize: 12,color: Colors.grey),), + Text('Copyright © 2008-2020 Toly1994',style: TextStyle(fontSize: 12,color: Colors.grey),), + ], + ); + } + + _launchURL(String url) async { + if (await canLaunch(url)) { + await launch(url); + } else { + + } + } +} diff --git a/lib/views/pages/home/home_drawer.dart b/lib/views/pages/home/home_drawer.dart index a0c8429..1ae3995 100644 --- a/lib/views/pages/home/home_drawer.dart +++ b/lib/views/pages/home/home_drawer.dart @@ -27,7 +27,7 @@ class HomeDrawer extends StatelessWidget { padding: EdgeInsets.zero, children: [ UnitDrawerHeader(color: color), - _buildItem(context, TolyIcon.icon_them, '我的主题', Router.setting), + _buildItem(context, TolyIcon.icon_them, '应用设置', Router.setting), _buildItem(context, TolyIcon.icon_layout, '数据统计', null), Divider(height: 1), _buildFlutterUnit(context), diff --git a/lib/views/pages/home/home_page.dart b/lib/views/pages/home/home_page.dart index 613df26..6b74cdb 100644 --- a/lib/views/pages/home/home_page.dart +++ b/lib/views/pages/home/home_page.dart @@ -18,7 +18,7 @@ class HomePage extends StatefulWidget { _HomePageState createState() => _HomePageState(); } -class _HomePageState extends State with AutomaticKeepAliveClientMixin{ +class _HomePageState extends State with AutomaticKeepAliveClientMixin{ ScrollController _ctrl; double _limitY = 35; double _height = kToolbarHeight * 2 - 20; diff --git a/lib/views/pages/setting/setting_page.dart b/lib/views/pages/setting/setting_page.dart index 7ccc375..483e5f2 100644 --- a/lib/views/pages/setting/setting_page.dart +++ b/lib/views/pages/setting/setting_page.dart @@ -14,7 +14,7 @@ class SettingPage extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('主题设置'), + title: Text('应用设置'), ), body: ListView( children: [ @@ -59,6 +59,15 @@ class SettingPage extends StatelessWidget { ), Divider(), _buildShowBg(context), + ListTile( + leading: Icon( + Icons.info, + color: Theme.of(context).primaryColor, + ), + title: Text('版本信息'), + trailing: _nextIcon(context), + onTap: () => Navigator.of(context).pushNamed(Router.version_info), + ), ], ), );