diff --git a/assets/iconfont/iconfont.ttf b/assets/iconfont/iconfont.ttf index 2b1e210..961ac27 100644 Binary files a/assets/iconfont/iconfont.ttf and b/assets/iconfont/iconfont.ttf differ diff --git a/assets/images/wechat.jpg b/assets/images/wechat.jpg new file mode 100644 index 0000000..91cc16a Binary files /dev/null and b/assets/images/wechat.jpg differ diff --git a/assets/images/wei_x.jpg b/assets/images/wei_x.jpg new file mode 100644 index 0000000..45c3c19 Binary files /dev/null and b/assets/images/wei_x.jpg differ diff --git a/lib/app/res/cons.dart b/lib/app/res/cons.dart index b925562..050fa7e 100644 --- a/lib/app/res/cons.dart +++ b/lib/app/res/cons.dart @@ -3,12 +3,8 @@ import 'package:flutter_unit/app/style/TolyIcon.dart'; import 'package:flutter_unit/components/permanent/code/highlighter_style.dart'; class Cons { - static const TABS = [ - "Stateless", - "Statefule", - "Single", - "Multi", - ]; //标题列表 + static String version = 'V1.0.0'; + static const MENU_INFO = ["关于", "帮助", "问题反馈"]; //菜单栏 static const ICONS_MAP = { //底栏图标 @@ -26,7 +22,6 @@ class Cons { 0xff0000FF, 0xff8B00FF ]; - static const rainbowInfo = ["红色", "橙色", "黄色", "绿色", "青色", "蓝色", "紫色"]; static const tabColors = [ 0xff44D1FD, diff --git a/lib/app/router.dart b/lib/app/router.dart index 317aa00..115ad07 100644 --- a/lib/app/router.dart +++ b/lib/app/router.dart @@ -1,4 +1,7 @@ import 'package:flutter/material.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/search/serach_page.dart'; import 'package:flutter_unit/views/pages/setting/code_style_setting.dart'; import 'package:flutter_unit/views/pages/setting/font_setting.dart'; import 'package:flutter_unit/views/pages/setting/item_style_setting.dart'; @@ -9,7 +12,6 @@ import 'package:flutter_unit/views/pages/collect_page.dart'; import 'package:flutter_unit/views/pages/detail/widget_detail_page.dart'; import 'package:flutter_unit/views/pages/unit_todo/layout_unit_page.dart'; import 'package:flutter_unit/views/pages/unit_todo/paint_unit_page.dart'; -import 'package:flutter_unit/views/search/serach_page.dart'; import 'package:flutter_unit/views/pages/setting/setting_page.dart'; import 'package:flutter_unit/views/pages/navigation/unit_navigation.dart'; @@ -34,6 +36,8 @@ class Router { static const String bug = 'BugUnitPage'; static const String paint = 'PaintUnitPage'; static const String layout = 'LayoutUnitPage'; + static const String about_me = 'AboutMePage'; + static const String about_app = 'AboutAppPage'; static Route generateRoute(RouteSettings settings) { switch (settings.name) { @@ -66,6 +70,10 @@ class Router { return Right2LeftRouter(child: PaintUnitPage()); case layout: return Right2LeftRouter(child: LayoutUnitPage()); + case about_app: + return Right2LeftRouter(child: AboutAppPage()); + case about_me: + return Right2LeftRouter(child: AboutMePage()); default: return MaterialPageRoute( diff --git a/lib/app/style/TolyIcon.dart b/lib/app/style/TolyIcon.dart index 5909c5e..681afdc 100644 --- a/lib/app/style/TolyIcon.dart +++ b/lib/app/style/TolyIcon.dart @@ -4,6 +4,10 @@ import 'package:flutter/widgets.dart'; class TolyIcon { TolyIcon._(); +static const IconData icon_email = const IconData( 0xe694, fontFamily: "TolyIcon"); +static const IconData icon_github = const IconData( 0xe689, fontFamily: "TolyIcon"); +static const IconData icon_juejin = const IconData( 0xe601, fontFamily: "TolyIcon"); +static const IconData icon_share = const IconData( 0xe613, fontFamily: "TolyIcon"); static const IconData icon_background = const IconData( 0xe60a, fontFamily: "TolyIcon"); static const IconData icon_code = const IconData( 0xe70b, fontFamily: "TolyIcon"); static const IconData icon_item = const IconData( 0xe66f, fontFamily: "TolyIcon"); diff --git a/lib/components/project/widget_node_panel.dart b/lib/components/project/widget_node_panel.dart index 5adf2e7..8a91cb8 100644 --- a/lib/components/project/widget_node_panel.dart +++ b/lib/components/project/widget_node_panel.dart @@ -5,6 +5,7 @@ import 'package:flutter_unit/app/utils/Toast.dart'; import 'package:flutter_unit/components/permanent/circle.dart'; import 'package:flutter_unit/components/permanent/code/code_panel.dart'; import 'package:flutter_unit/components/permanent/panel.dart'; +import 'package:share/share.dart'; import 'package:toggle_rotate/toggle_rotate.dart'; import '../permanent/feedback_widget.dart'; @@ -62,15 +63,16 @@ class _WidgetNodePanelState extends State mode: FeedMode.fade, a: 0.4, onPressed: () async { - await Clipboard.setData(ClipboardData(text: widget.code)); - Toast.toast(context, '复制成功!'); +// await Clipboard.setData(ClipboardData(text: widget.code)); +// Toast.toast(context, '复制成功!'); + Share.share(widget.code); }, child: Padding( padding: const EdgeInsets.only( right: 10, ), child: Icon( - Icons.content_copy, + TolyIcon.icon_share, size: 20, color: Theme.of(context).primaryColor, ), diff --git a/lib/main.dart b/lib/main.dart index b03e01d..da34e94 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -5,7 +5,7 @@ import 'package:flutter_unit/blocs/collect/collect_event.dart'; import 'package:flutter_unit/blocs/search/search_bloc.dart'; import 'package:flutter_unit/repositorys/widget_db_repository.dart'; import 'package:flutter_unit/storage/app_storage.dart'; -import 'package:flutter_unit/views/splash/unit_splash.dart'; +import 'package:flutter_unit/views/pages/splash/unit_splash.dart'; //import 'tools/initial.dart'; import 'blocs/collect/collect_bloc.dart'; @@ -31,6 +31,7 @@ final storage = AppStorage(); class BlocWrapper extends StatelessWidget { final Widget child; + BlocWrapper({this.child}); final repository = WidgetDbRepository(storage); diff --git a/lib/views/dialogs/dialog_about.dart b/lib/views/dialogs/dialog_about.dart index b74eaa4..0be88d3 100644 --- a/lib/views/dialogs/dialog_about.dart +++ b/lib/views/dialogs/dialog_about.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_unit/app/res/cons.dart'; class DialogAbout extends StatelessWidget { static show(BuildContext context){ @@ -39,7 +40,7 @@ class DialogAbout extends StatelessWidget { height: 20, ), Text( - "Flutter Unit V0.0.1", + "Flutter Unit ${Cons.version}", ), ]); return AlertDialog(title: title, content: content, actions: [ diff --git a/lib/views/pages/about/about_app_page.dart b/lib/views/pages/about/about_app_page.dart new file mode 100644 index 0000000..c15764e --- /dev/null +++ b/lib/views/pages/about/about_app_page.dart @@ -0,0 +1,241 @@ +import 'package:flutter/cupertino.dart'; +/// create by 张风捷特烈 on 2020-04-13 +/// contact me by email 1981462002@qq.com +/// 说明: + +import 'package:flutter/material.dart'; +import 'package:flutter_unit/app/style/TolyIcon.dart'; +import 'package:flutter_unit/components/permanent/circle.dart'; +import 'package:flutter_unit/components/permanent/circle_image.dart'; +import 'package:flutter_unit/components/permanent/feedback_widget.dart'; +import 'package:flutter_unit/components/permanent/panel.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class AboutAppPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Stack( + children: [ + Column( + children: [ + Container( + height: 150, + width: MediaQuery.of(context).size.width, + margin: EdgeInsets.only(bottom: 50), + child: Image.asset( + 'assets/images/sabar.jpg', + fit: BoxFit.cover, + ), + ), + ], + ), + _buildBar(context), + Positioned( + bottom: 0, + left: 50, + child: CircleImage( + size: 100, + shadowColor: Theme.of(context).primaryColor, + image: AssetImage('assets/images/icon_head.png'), + )), + ], + ), + ), + Expanded( + child: SingleChildScrollView( + child: Container( + margin: EdgeInsets.all(24), + child: _buildInfo(), + ), + ), + ), + ], + ), + ); + } + + Widget _buildBar(BuildContext context) { + return Container( + height: kToolbarHeight, + margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), + child: Row( + children: [ + GestureDetector( + onTap: () => Navigator.of(context).pop(), + child: Container( + padding: EdgeInsets.only(left: 10), + child: Icon( + Icons.arrow_back, + size: 30, + color: Theme.of(context).primaryColor, + ), + ), + ), + Spacer(), + FeedbackWidget( + onPressed: () => + _launchURL("mailto:1981462002@qq.com?subject=来自Flutter Unit"), + child: Icon( + TolyIcon.icon_email, + size: 20, + color: Theme.of(context).primaryColor, + ), + ), + SizedBox( + width: 20, + ) + ], + ), + ); + } + + _launchURL(String url) async { + if (await canLaunch(url)) { + await launch(url); + } else { + debugPrint('Could not launch $url'); + } + } + + Widget _buildInfo() { + return Stack( + children: [ + Positioned( + right: 10, + top: 0, + 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"), + child: Wrap( + direction: Axis.vertical, + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + Icon( + TolyIcon.icon_github, + size: 35, + ), + Text('Github') + ], + )), + ], + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Flutter Unit', + style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold), + ), + SizedBox(height: 10), + Text( + 'The Unity Of Flutter, The Unity Of Coder.', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + 'Flutter的联合,编程者的联合。', + style: TextStyle(fontSize: 16), + ), + Divider( + height: 20, + ), + InfoPanel( + title: '项目简介', + info: ' Flutter Unit 是一个非盈利性的开源项目,' + '旨在提供全面的Flutter学习指南及编程者的交流技术的接口。' + '由【张风捷特烈】提供技术支持和全权维护。唯一开源网站网址: ' + 'https://github.com/toly1994328/FlutterUnit', + ), + Divider( + height: 20, + ), + InfoPanel( + title: 'Flutter Unit 1.0', + info: 'Flutter Unit 1.0 核心计划是收录widget,即widget集录。' + '目前收录组件204个,均可在app中进行查看。' + '项目中提供widget图鉴文件可供下载参考。功能主要如下:\n' + '○ 200+的Flutter 组件收录和详情介绍。\n' + '○ 对一些重要的组件提供操作体验。\n' + '○ link to功能,查看组件时可以切换到相关组件。\n' + '○ 组件收藏和取消收藏功能。\n' + '○ 主题设置,字体设置,代码风格等全局状态管理。\n' + '○ 搜索功能和组件星级分类。', + ), + Divider( + height: 20, + ), + InfoPanel( + title: 'Flutter Unit 2.0 计划', + info: 'Flutter Unit 2.0 尚在计划之中,如果说1.0是我单枪匹马,' + '那2.0将是Flutter爱好者的共同努力。后面陆续会发布一些征集方案,' + '包括属性、布局、绘制、bug、要点集录等。我想让Unit 成为一个Flutter的圣地,纯粹而强大,期待与你的共同携手。', + ) + ], + ), + ], + ); + } +} + +class InfoPanel extends StatelessWidget { + final String title; + final String info; + + + InfoPanel({this.title, this.info}); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Circle(color: Theme.of(context).primaryColor,), Padding( + padding: const EdgeInsets.only(left: 15,top: 15,bottom: 15), + child: Text('$title',style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold),), + ) + ], + ), + Panel( + color: Theme.of(context).primaryColor.withAlpha(33), + child: Text( + '$info', + style: TextStyle(color: Colors.grey, + shadows: [ + Shadow( + color: Colors.white, + offset: Offset(1,1) + ) + ]), + ), + ), + ], + ); + } +} diff --git a/lib/views/pages/about/about_me_page.dart b/lib/views/pages/about/about_me_page.dart new file mode 100644 index 0000000..16300cc --- /dev/null +++ b/lib/views/pages/about/about_me_page.dart @@ -0,0 +1,206 @@ +/// create by 张风捷特烈 on 2020-04-13 +/// contact me by email 1981462002@qq.com +/// 说明: + +import 'package:flutter/material.dart'; +import 'package:flutter_unit/app/style/TolyIcon.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'; + +class AboutMePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + Column( + children: [ + Container( + height: 200, + width: MediaQuery.of(context).size.width, + margin: EdgeInsets.only(bottom: 50), + child: Image.asset( + 'assets/images/sabar.jpg', + fit: BoxFit.cover, + ), + ), + ], + ), + _buildBar(context), + Positioned( + bottom: 0, + left: 50, + child: CircleImage( + size: 100, + shadowColor: Theme.of(context).primaryColor, + image: AssetImage('assets/images/icon_head.png'), + )), + ], + ), + Expanded( + child: Container( + margin: EdgeInsets.all(24), + child: Stack(children: [ + Positioned( + right: 10, + top: 0, + child: _buildLinkIcon(), + ), + _buildInfo() + ]), + ), + ), + ], + ), + ); + } + + Widget _buildBar(BuildContext context) { + return Container( + height: kToolbarHeight, + margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), + child: Row( + children: [ + GestureDetector( + onTap: () => Navigator.of(context).pop(), + child: Container( + padding: EdgeInsets.only(left: 10), + child: Icon( + Icons.arrow_back, + size: 30, + color: Theme.of(context).primaryColor, + ), + ), + ), + Spacer(), + FeedbackWidget( + onPressed: () => + _launchURL("mailto:1981462002@qq.com?subject=来自Flutter Unit"), + child: Icon( + TolyIcon.icon_email, + size: 20, + color: Theme.of(context).primaryColor, + ), + ), + SizedBox( + width: 20, + ) + ], + ), + ); + } + + _launchURL(String url) async { + if (await canLaunch(url)) { + await launch(url); + } else { + debugPrint('Could not launch $url'); + } + } + + Widget _buildInfo() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '张风捷特烈', + style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold), + ), + SizedBox(height: 10), + Text( + 'The King Of Coder. 「编程之王」', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + '海的彼岸有我未曾见证的风采。', + style: TextStyle(fontSize: 16), + ), + Divider( + height: 20, + ), + Row( + children: [ + Text( + '编程技术交流圣地-Flutter群,愿青梅煮酒,与君共话。', + style: TextStyle(color: Colors.grey), + ), + ], + ), + SizedBox(height: 16), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Container( + width: 190, + child: Column( + children: [ + Image.asset('assets/images/wechat.jpg'), + Text( + '我的微信', + style: TextStyle(fontSize: 16), + ), + ], + ), + ), +// Container( +// width: 160, +// child: Column( +// children: [ +// Image.asset('assets/images/wei_x.jpg'), +// Text( +// '请我喝茶(慎扫)', +// style: TextStyle(fontSize: 16), +// ), +// ], +// ), +// ), + ], + ), + ], + ); + } + + Wrap _buildLinkIcon() { + return 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"), + child: Wrap( + direction: Axis.vertical, + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + Icon( + TolyIcon.icon_github, + size: 35, + ), + SizedBox(height: 4,), + Text('Github') + ], + )), + ], + ); + } +} diff --git a/lib/views/search/serach_page.dart b/lib/views/pages/search/serach_page.dart similarity index 99% rename from lib/views/search/serach_page.dart rename to lib/views/pages/search/serach_page.dart index 0009421..d98f00b 100644 --- a/lib/views/search/serach_page.dart +++ b/lib/views/pages/search/serach_page.dart @@ -19,7 +19,8 @@ import 'package:flutter_unit/views/pages/search/loading_page.dart'; import 'package:flutter_unit/views/pages/search/not_search_page.dart'; import 'package:flutter_unit/views/pages/search/start_filter.dart'; -import '../pages/common/empty_page.dart'; +import 'empty_page.dart'; + class SearchPage extends StatefulWidget { @override diff --git a/lib/views/pages/setting/home_drawer.dart b/lib/views/pages/setting/home_drawer.dart index 93761ce..a4cfddb 100644 --- a/lib/views/pages/setting/home_drawer.dart +++ b/lib/views/pages/setting/home_drawer.dart @@ -79,12 +79,21 @@ class HomeDrawer extends StatelessWidget { ), ListTile( leading: Icon( - TolyIcon.icon_kafei, + Icons.info, color: Theme.of(context).primaryColor, ), title: Text('关于应用'), trailing: _nextIcon(context), - onTap: () {}, + onTap: () => Navigator.of(context).pushNamed(Router.about_app), + ), + ListTile( + leading: Icon( + TolyIcon.icon_kafei, + color: Theme.of(context).primaryColor, + ), + title: Text('联系本王'), + trailing: _nextIcon(context), + onTap: () => Navigator.of(context).pushNamed(Router.about_me), ), ], ), @@ -116,9 +125,7 @@ class HomeDrawer extends StatelessWidget { ), title: Text('绘画集录'), trailing: _nextIcon(context), - onTap: () { - Navigator.of(context).pushNamed(Router.paint); - }, + onTap: () => Navigator.of(context).pushNamed(Router.paint), ), ListTile( leading: Icon( diff --git a/lib/views/splash/unit_paint.dart b/lib/views/pages/splash/unit_paint.dart similarity index 100% rename from lib/views/splash/unit_paint.dart rename to lib/views/pages/splash/unit_paint.dart diff --git a/lib/views/splash/unit_splash.dart b/lib/views/pages/splash/unit_splash.dart similarity index 100% rename from lib/views/splash/unit_splash.dart rename to lib/views/pages/splash/unit_splash.dart diff --git a/pubspec.lock b/pubspec.lock index c0db943..f2b6415 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -156,6 +156,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.4.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.2" provider: dependency: transitive description: @@ -177,6 +184,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.23.1" + share: + dependency: "direct main" + description: + name: share + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.6.3+6" shared_preferences: dependency: "direct main" description: @@ -287,6 +301,34 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.1.6" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.flutter-io.cn" + source: hosted + version: "5.4.2" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.0.1+4" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.6" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.1+1" vector_math: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 369429c..384863c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -28,6 +28,8 @@ dependencies: toggle_rotate: ^0.0.5 flutter_star: ^0.1.2 # 星星组件 shared_preferences: ^0.5.6+3 # xml 固化 + url_launcher: ^5.4.2 # url + share: ^0.6.3+6 dev_dependencies: flutter_test: sdk: flutter