From c378a6203c542a5bc0682086f1e8ac97e42f04be Mon Sep 17 00:00:00 2001 From: peima Date: Mon, 28 Dec 2020 00:19:04 -0500 Subject: [PATCH] backup. --- android/settings_aar.gradle | 1 + fonts/company.ttf | Bin 3596 -> 0 bytes fonts/wisetronic.ttf | Bin 2264 -> 7088 bytes lib/constants.dart | 15 + lib/generated/intl/messages_en.dart | 4 + lib/generated/intl/messages_zh_CN.dart | 4 + lib/generated/l10n.dart | 20 ++ lib/l10n/intl_en.arb | 4 +- lib/l10n/intl_zh_CN.arb | 4 +- lib/main.dart | 13 +- lib/pages/download.dart | 57 ++++ lib/pages/home.dart | 5 +- lib/routes.dart | 11 +- lib/utils/extensions.dart | 6 + lib/utils/http_util.dart | 3 +- lib/utils/utils.dart | 42 +++ .../desktop/desktop_download_apps.dart | 76 +++++ .../desktop/desktop_index_main_content_3.dart | 26 +- .../desktop/desktop_navigationbar.dart | 114 ++++---- lib/widgets/general/bottom_nav.dart | 2 +- lib/widgets/general/download_apps.dart | 47 ++++ lib/widgets/general/download_item.dart | 260 +++++++++++++++++- lib/widgets/general/navigationbar.dart | 10 +- lib/widgets/general/navigationbar_logo.dart | 4 +- lib/widgets/general/text_link.dart | 46 +++- lib/widgets/mobile/mobile_download_apps.dart | 61 ++++ .../mobile/mobile_index_main_content_2.dart | 18 +- .../mobile/mobile_index_main_content_3.dart | 18 +- .../mobile/mobile_navigation_drawer.dart | 50 ++-- .../mobile_navigation_drawer_header.dart | 5 +- lib/widgets/mobile/mobile_navigationbar.dart | 90 +++--- pubspec.lock | 12 +- pubspec.yaml | 5 +- 33 files changed, 833 insertions(+), 200 deletions(-) create mode 100644 android/settings_aar.gradle delete mode 100644 fonts/company.ttf create mode 100644 lib/pages/download.dart create mode 100644 lib/utils/extensions.dart create mode 100644 lib/widgets/desktop/desktop_download_apps.dart create mode 100644 lib/widgets/general/download_apps.dart create mode 100644 lib/widgets/mobile/mobile_download_apps.dart diff --git a/android/settings_aar.gradle b/android/settings_aar.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/android/settings_aar.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/fonts/company.ttf b/fonts/company.ttf deleted file mode 100644 index bdcafb4b91b5d1d39c039b68878c2f03a28885a2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3596 zcmd^CS#Mj{5uS5*UfzW}C6N{{Ntu)^iKMtnwo6HtA}h5WJ6;q=m21#4CCcVziE<<_ zX&;Joi4nMHP&5q?6h$9W1no=Fq9|G;PpzAWKDK~i6nQ8L0uA!y7DbSVopX8F$VL1M zddR~&^Ua(&vz#-!0s;Vb_&TtVI)3iLG2``vw*bf_qUTSaOQws)^LLQHhy2oNt<-$@ zvyc7)z#vP0wO-v_d;eD7F9Fzx0K!hCT)GS z_5VH;GXWQ^G+;*P;iJ>cAk8ApFxIwhOE-mK@h1~L` z+RdetiD6Yy_g*86e&YI<7H==&cVcK$ctvy zL?J@mjK`uTYlhGZppZ8`{XDCf#00K1AIy)UCnr=@h{c9dipB;9^Z~Ez413l71A4!I zB2@^-2Kq+gOJS$O=JKk(tY7uHY!2thp@AWnU3TQcA>n{gbVQ63>@XS1gdzrUIdh@N z4>OtE@$q z$b+6zQ(Xfl_$eV|g5d?5qPzXsaFh_IW76=tb=4;EWIEy>;&X)MMOk%6HT&U_!3-~k zgNMRn4km$12`701$vyUr;bs_4RCHh9pwZ{m6p3e;9K#6`+U<8~lE^TBBxp#{`~l|R z_W0!6xeH65?esfUNnptL7)F#dC-DVcI^_u?*fe+E-D4!(MV5#lIXod%mo-8Zn@iCd z$KJoN_=AGT+c;s+C>#t91O-mQ5MRAW6laVVd5PnRLk&p!P{QvfZciv1iEFG^@u^OR zWCw>8O>^rmSrJ9MO|jW%deD|)(-qaOIUGKx*RDyA&y&=9@Ab=)CMz<2HAyB!liiv_ zQ+3s8S5?`qI#i@xcJ-nl;!{=#o+y_ti#$u)674^ohwOKlC*Xk*I0C17_u9PHpI>Rw zET@M$Viqq;%j9=v(nXTRW93czJi;h(iV=-?@G9jZv26Ybab}$4N&WIlzEH@oTz=dm z>X%+Tl}IKNr(XO`kGOL;Iu#C2Mf+p1{^BS5=xOH3Q)^8l#i!PqM(*x?J3jN}*?4h$ zZk$X_$7Ye99zQm|_XqL{#)*Bk^A`Ja>`_^_wpB}kG4DUuK|doi{>^D5-BXokFyoL5E_ z2lG7Ragax$m}hb>*dOMxtc#LnyUU9?3D@eTgmF$5MX(Iih(CZ+yVb ziLyghR6$`s{UFT-oXo3z())J72o&Bg`W?Zc?2JzpgMFgJ=(1$j6-jfezR*z7 z<)LQ;zy*J$e|^lcfWKXuV1He(Xa?V+&RR5!_{$c}Azij;9^XQ5ShRrn9gCJ>6uxEA zcC61Y=vxVA!+q|-?=6}@A31B$3~1z z#*EE1n!B4D>y?%K7rNrvX7g-$eY;xP+z;)im&%)48;!a#kx1=_kC*G^%~Gp;m2SUv zb3NT^tr=^ZjheAw?PD}I8`sLKtwg2OY93A|_wNsL(10fF!X|9MI#i$q2EHZC;hi=h zjqk8@8gKL<*+wh%px{UiCz`0+i-9Q1#Q zFB&3Y2unD^6M=|C0+pVrt;zBAMq|BN?z6a3t#qqVA1_tQJEiezW4+<*37XAn*+lFX gQod5!?MZKJZ>(Ow(r8@Y(k$s#rP172+ciD;550RWF#rGn diff --git a/fonts/wisetronic.ttf b/fonts/wisetronic.ttf index f6b6f81bd5a95fe475109a912ea3f47199bf8be1..1d2073f592253424c6be807faa6fe3b2aaca803b 100644 GIT binary patch literal 7088 zcmd@(X>(l1aWn6lckjNv-d@;!``%u_9su?Puf@enq$toNNKq6e0wh5KB!GnoP$G3( zapXfJ#fnvqRB}0&rIKPvRjO1RC#Bf=64`N_L?x%9DwoPurBV)(xLlQ(acsw0r04BI zqEyx|$a_23?w;wMo}QlWo&~}PAq72-STwZf@R14Ysmy~2;Sr!tPaPhtw51Vb|%1 zch%pGY<_QaHZE%u>`uT%#84_cRFVfbk?vxYD#MG=hKqOmWi*6Zh}pUO_GzR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ea1dkJcFI)YMY|02BY5Bd(kEW1C#Jr269 zfPc(^ZkM2E79@Vss86CFb@f;UP3Wu^+?30(rcWBZ2SzWu9J8*5XMm%-`c-s4Xi;%j zcGg|RMUc1z(C&||#{!*c-+7R88pfAhyRHFsE99QRPh7uyF#zwSzhD2R#{-9p#TE^DJlKmg>SL=TrE~4}xy89~51U<@eXzY;nq8c`JX>09pKBYN9V;t~ zb1p^cQRYs~UfJxu@6y8Q3#Z!c3#)pscXhtKvT*haSz1_Lfd6C34=gO7X+N-98Xh9E r%V#dO7tZjrR3y95UKK8#y0pA@3C66>tzB#{FPtW8?Ugl952619V2XQ} delta 437 zcmdmBenW7AQoUa!0|R3Z0|P@?a&BV5OO4&Dfc!T=T#%kqnWk3Opvb_$oWj7s#FCMk zn4%JM^E*)O10Xib01609f$<5D;K<2OPGn>P@tI?Q1Y2%m zMFFD}!!4k^1dy+gmzbNnqJH)SX$A(?44@)|g8bqV3uAdvpxzlk1$GRKK+&N8Squ!k zYk+(PUMG+U3Sa_@07dmqFY%4%xB1Gz&HMtS;`ZOu+6empC0-|{S3o`o1K2@87RV$f zhI5k@81tAoPEDS`XwS$n`2wRv5X3G9R-imH5bFRj3s89o)NVhZC`hjkkmdr5voI)u z)v$oXUoiat4 args); class MessageLookup extends MessageLookupByLibrary { String get localeName => 'en'; + static m0(oss) => "Download at ${oss}"; + final messages = _notInlinedMessages(_notInlinedMessages); static _notInlinedMessages(_) => { "about" : MessageLookupByLibrary.simpleMessage("About"), @@ -27,8 +29,10 @@ class MessageLookup extends MessageLookupByLibrary { "contact_us" : MessageLookupByLibrary.simpleMessage("Contact us"), "developer_of" : MessageLookupByLibrary.simpleMessage("Developers of"), "download" : MessageLookupByLibrary.simpleMessage("Download"), + "download_with_token" : m0, "home" : MessageLookupByLibrary.simpleMessage("Home"), "information" : MessageLookupByLibrary.simpleMessage("Information"), + "install_in_store" : MessageLookupByLibrary.simpleMessage("Install in store"), "learn_more" : MessageLookupByLibrary.simpleMessage("Learn more..."), "license_agreement" : MessageLookupByLibrary.simpleMessage("License agreement"), "loading_please_wait" : MessageLookupByLibrary.simpleMessage("Loading, please wait..."), diff --git a/lib/generated/intl/messages_zh_CN.dart b/lib/generated/intl/messages_zh_CN.dart index 6332746..721a261 100644 --- a/lib/generated/intl/messages_zh_CN.dart +++ b/lib/generated/intl/messages_zh_CN.dart @@ -19,6 +19,8 @@ typedef String MessageIfAbsent(String messageStr, List args); class MessageLookup extends MessageLookupByLibrary { String get localeName => 'zh_CN'; + static m0(oss) => "在${oss}下载"; + final messages = _notInlinedMessages(_notInlinedMessages); static _notInlinedMessages(_) => { "about" : MessageLookupByLibrary.simpleMessage("关于"), @@ -27,8 +29,10 @@ class MessageLookup extends MessageLookupByLibrary { "contact_us" : MessageLookupByLibrary.simpleMessage("联系我们"), "developer_of" : MessageLookupByLibrary.simpleMessage("开发者"), "download" : MessageLookupByLibrary.simpleMessage("下载"), + "download_with_token" : m0, "home" : MessageLookupByLibrary.simpleMessage("首页"), "information" : MessageLookupByLibrary.simpleMessage("信息"), + "install_in_store" : MessageLookupByLibrary.simpleMessage("店内安装"), "learn_more" : MessageLookupByLibrary.simpleMessage("了解更多..."), "license_agreement" : MessageLookupByLibrary.simpleMessage("许可协议"), "loading_please_wait" : MessageLookupByLibrary.simpleMessage("装载中,清稍候..."), diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 948a21e..d47c366 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -334,6 +334,26 @@ class S { args: [], ); } + + /// `Download at {oss}` + String download_with_token(Object oss) { + return Intl.message( + 'Download at $oss', + name: 'download_with_token', + desc: '', + args: [oss], + ); + } + + /// `Install in store` + String get install_in_store { + return Intl.message( + 'Install in store', + name: 'install_in_store', + desc: '', + args: [], + ); + } } class AppLocalizationDelegate extends LocalizationsDelegate { diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 36ada03..d915650 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -28,5 +28,7 @@ "shop": "Shop", "blog": "Blog", "login": "Login", - "logout": "Logout" + "logout": "Logout", + "download_with_token": "Download at {oss}", + "install_in_store": "Install in store" } \ No newline at end of file diff --git a/lib/l10n/intl_zh_CN.arb b/lib/l10n/intl_zh_CN.arb index 3a202bf..d1854b8 100644 --- a/lib/l10n/intl_zh_CN.arb +++ b/lib/l10n/intl_zh_CN.arb @@ -28,5 +28,7 @@ "shop": "线上购买", "blog": "博客", "login": "登入", - "logout": "登出" + "logout": "登出", + "download_with_token": "在{oss}下载", + "install_in_store": "店内安装" } \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 62b5686..453caa8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -4,19 +4,14 @@ import 'package:flutter/material.dart'; import 'package:flutter_device_locale/flutter_device_locale.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_redux/flutter_redux.dart'; -import 'package:flutter_wisetronic/events/events.dart'; -import 'package:flutter_wisetronic/routes.dart'; -import 'package:flutter_wisetronic/store/actions.dart'; -import 'package:flutter_wisetronic/widgets/general/navigationbar.dart'; -import 'package:flutter_wisetronic/widgets/mobile/mobile_navigation_drawer.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; -import 'package:responsive_builder/responsive_builder.dart'; import 'package:splashscreen/splashscreen.dart'; import 'constants.dart'; -import 'events/eventbus.dart'; import 'generated/l10n.dart'; import 'pages/home.dart'; +import 'routes.dart'; +import 'store/actions.dart'; import 'store/store.dart'; void main() async { @@ -70,7 +65,9 @@ class MyApp extends StatelessWidget { localeResolutionCallback: (Locale locale, Iterable supportedLocales) { print('Language code: ${localLocate.languageCode}'); for (final supportedLocale in supportedLocales) { - return supportedLocale; + if (supportedLocale.languageCode == localLocate.languageCode) { + return supportedLocale; + } } return supportedLocales.first; }, diff --git a/lib/pages/download.dart b/lib/pages/download.dart new file mode 100644 index 0000000..468aac6 --- /dev/null +++ b/lib/pages/download.dart @@ -0,0 +1,57 @@ + +import 'package:flutter/material.dart'; +import 'package:flutter_wisetronic/widgets/general/download_apps.dart'; +import '../events/eventbus.dart'; +import '../events/events.dart'; +import '../generated/l10n.dart'; +import '../utils/double_back_to_close_app.dart'; +import '../widgets/general/bottom_nav.dart'; +import '../widgets/mobile/mobile_navigation_drawer.dart'; +import '../widgets/general/navigationbar.dart'; +import 'package:responsive_builder/responsive_builder.dart'; + +class Download extends StatefulWidget { + + @override + State createState() { + return DownloadState(); + } + +} + +class DownloadState extends State { + final _scaffoldKey = GlobalKey(); + + @override + Widget build(BuildContext context) { + + return ResponsiveBuilder( + builder: (context, sizingInformation) => + Scaffold( + key: _scaffoldKey, + appBar: NavigationBar(title: S.of(context).download,), + drawer: sizingInformation.deviceScreenType == DeviceScreenType.mobile ? MobileNavigationDrawer() : null, + body: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + DownloadApps(), + ], + ), + ), + bottomNavigationBar: BottomNav(), + ), + ); + } + + @override + void initState() { + super.initState(); + eventBus.on().listen((event) { + if (mounted) { + _scaffoldKey.currentState.openDrawer(); + } + }); + + } +} \ No newline at end of file diff --git a/lib/pages/home.dart b/lib/pages/home.dart index 31bcaee..0258bb4 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -19,10 +19,11 @@ import '../widgets/mobile/mobile_navigation_drawer.dart'; import 'package:responsive_builder/responsive_builder.dart'; class Home extends StatefulWidget { - final Locale locale; + Locale locale; final String title; - Home(this.locale, {Key key, this.title}) : super(key: key); + Home(Locale locale, {Key key, this.title}) : + locale = locale ?? store.state.locale; @override State createState() { diff --git a/lib/routes.dart b/lib/routes.dart index 778a059..ebbab7f 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,6 +1,9 @@ import 'package:fluro/fluro.dart'; import 'package:flutter/material.dart'; +import 'pages/download.dart'; +import 'store/store.dart'; +import 'pages/home.dart'; class Routes { static final router = FluroRouter(); @@ -8,9 +11,15 @@ class Routes { static void configure() { router.define('/', handler: new Handler( handlerFunc: (BuildContext context, Map> params) { - return null; + return Home(null); }), transitionType: TransitionType.fadeIn ); + router.define('/download', handler: new Handler( + handlerFunc: (BuildContext context, Map> params) { + return Download(); + }), + transitionType: TransitionType.inFromRight + ); } } \ No newline at end of file diff --git a/lib/utils/extensions.dart b/lib/utils/extensions.dart new file mode 100644 index 0000000..0b9362b --- /dev/null +++ b/lib/utils/extensions.dart @@ -0,0 +1,6 @@ + +extension StringCap on String { + String get firstCap => '${this[0].toUpperCase()}${this.substring(1)}'; + String get allCaps => this.toUpperCase(); + String get eachFirstCap => this.split(" ").map((str) => str.firstCap).join(" "); +} \ No newline at end of file diff --git a/lib/utils/http_util.dart b/lib/utils/http_util.dart index 9e942e9..a119f97 100644 --- a/lib/utils/http_util.dart +++ b/lib/utils/http_util.dart @@ -35,9 +35,10 @@ class HttpUtil { 'Http-Business-Id': '0', 'Http-App-Key': '', 'Http-Contact-Authorization': '', - 'Http-Device-Type': Platform.isIOS ? 'ios' : (Platform.isAndroid ? 'android' : 'web'), + 'Http-Device-Type': Utils.getOs(checkWeb: true), 'Http-Api-Branch': 'flutter', 'Http-Language-Code': store.state.locale.languageCode, + 'Http-Country-Code': store.state.locale.countryCode, }; static Future httpGet(String url, diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 1531594..f7a2f1c 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -12,6 +12,7 @@ import 'package:hive/hive.dart'; import 'package:intl/intl.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:universal_io/io.dart'; +import '../constants.dart'; import 'util_web.dart' if (dart.library.io) 'util_io.dart'; import '../routes.dart'; @@ -267,6 +268,47 @@ class Utils { onError(error); }); } + + static String getOs({bool checkWeb = false}) { + if (checkWeb && kIsWeb) { + return 'web'; + } + if (Platform.isAndroid) { + return 'android'; + } + if (Platform.isIOS) { + return 'ios'; + } + if (Platform.isLinux) { + return 'ubuntu'; + } + if (Platform.isMacOS) { + return 'mac'; + } + if (Platform.isWindows) { + return 'windows'; + } + return 'web'; + } + + static int getOsFontHex(String os) { + if (os == 'mac') { + return Constants.FONT_APPLE; + } + if (os == 'windows') { + return Constants.FONT_WINDOWS; + } + if (os == 'ubuntu') { + return Constants.FONT_UBUNTU; + } + if (os == 'android') { + return Constants.FONT_ANDROID; + } + if (os == 'ios') { + return Constants.FONT_IOS; + } + return Constants.FONT_TOPTONS; + } } class RuntimeError extends Error{ diff --git a/lib/widgets/desktop/desktop_download_apps.dart b/lib/widgets/desktop/desktop_download_apps.dart new file mode 100644 index 0000000..3c4b941 --- /dev/null +++ b/lib/widgets/desktop/desktop_download_apps.dart @@ -0,0 +1,76 @@ + +import 'package:flutter/material.dart'; +import '../../widgets/general/download_item.dart'; +import '../../store/store.dart'; +import '../../utils/util_web.dart' if (dart.library.io) '../../utils/util_io.dart'; + +class DesktopDownloadApps extends StatefulWidget { + final Map data; + + DesktopDownloadApps(this.data, {Key key}) : super(key: key); + + @override + State createState() { + return DesktopDownloadAppsState(); + } + +} + +class DesktopDownloadAppsState extends State { + double sideSpace = 0; + double mainSpace = 1200; + + @override + Widget build(BuildContext context) { + if (widget.data == null) { + return Container(); + } + if (MediaQuery.of(context).size.width <= 1200) { + mainSpace = MediaQuery.of(context).size.width; + sideSpace = 0; + } else { + mainSpace = 1200; + sideSpace = (MediaQuery.of(context).size.width - 1200) / 2; + } + Column col = Column( + children: [ + Util.showImage( + 'https:${widget.data['download-image']['image']}' + ), + ], + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + ); + List apps = _getApps(); + Wrap wrap = Wrap( + children: [], + ); + for (int i = 0; i < apps.length; i++) { + wrap.children.add(apps[i]); + } + col.children.add(wrap); + return Row( + children: [ + Container( + width: sideSpace, + ), + Container( + width: mainSpace, + child: col, + ), + Container( + width: sideSpace, + ), + ], + ); + } + + List _getApps() { + List apps = []; + for (int i = 0; i < (widget.data['apps'] as List).length; i++) { + apps.add(DownloadItem((widget.data['apps'] as List)[i], width: mainSpace / 2.0,)); + } + return apps; + } +} \ No newline at end of file diff --git a/lib/widgets/desktop/desktop_index_main_content_3.dart b/lib/widgets/desktop/desktop_index_main_content_3.dart index fd2b869..6f53b41 100644 --- a/lib/widgets/desktop/desktop_index_main_content_3.dart +++ b/lib/widgets/desktop/desktop_index_main_content_3.dart @@ -3,6 +3,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_wisetronic/generated/l10n.dart'; import 'package:flutter_wisetronic/widgets/general/text_link.dart'; +import '../../constants.dart'; + class DesktopIndexMainContent3 extends StatefulWidget { final Map content; const DesktopIndexMainContent3(this.content, {Key key}) : super(key: key); @@ -100,8 +102,8 @@ class DesktopIndexMainContent3State extends State { padding: EdgeInsets.all(10.0), child: Icon( IconData( - 0xe800, - fontFamily: 'company', + Constants.FONT_GOOGLE, + fontFamily: 'wisetronic', fontPackage: null ), color: Colors.white24, @@ -112,8 +114,8 @@ class DesktopIndexMainContent3State extends State { padding: EdgeInsets.all(10.0), child: Icon( IconData( - 0xe801, - fontFamily: 'company', + Constants.FONT_ALEXA, + fontFamily: 'wisetronic', fontPackage: null ), color: Colors.white24, @@ -124,8 +126,8 @@ class DesktopIndexMainContent3State extends State { padding: EdgeInsets.all(10.0), child: Icon( IconData( - 0xe802, - fontFamily: 'company', + Constants.FONT_APPLE, + fontFamily: 'wisetronic', fontPackage: null ), color: Colors.white24, @@ -136,8 +138,8 @@ class DesktopIndexMainContent3State extends State { padding: EdgeInsets.all(10.0), child: Icon( IconData( - 0xe803, - fontFamily: 'company', + Constants.FONT_EBAY, + fontFamily: 'wisetronic', fontPackage: null ), color: Colors.white24, @@ -148,8 +150,8 @@ class DesktopIndexMainContent3State extends State { padding: EdgeInsets.all(10.0), child: Icon( IconData( - 0xe804, - fontFamily: 'company', + Constants.FONT_QUICKBOOKS, + fontFamily: 'wisetronic', fontPackage: null ), color: Colors.white24, @@ -160,8 +162,8 @@ class DesktopIndexMainContent3State extends State { padding: EdgeInsets.all(10.0), child: Icon( IconData( - 0xe805, - fontFamily: 'company', + Constants.FONT_SHOPIFY, + fontFamily: 'wisetronic', fontPackage: null ), color: Colors.white24, diff --git a/lib/widgets/desktop/desktop_navigationbar.dart b/lib/widgets/desktop/desktop_navigationbar.dart index 68a5191..9d3df95 100644 --- a/lib/widgets/desktop/desktop_navigationbar.dart +++ b/lib/widgets/desktop/desktop_navigationbar.dart @@ -33,60 +33,68 @@ class DesktopNavigationBarState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ NavigationBarLogo(), - Container( - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - SizedBox(width: 20.0,), - TextLink( - S.of(context).home, - '/', - color: Colors.white, - selected: currentRoute == '/', + Expanded( + child: Container( + alignment: Alignment.centerRight, + padding: EdgeInsets.only(left: 8.0, right: 16.0), + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(width: 20.0,), + TextLink( + S.of(context).home, + '/', + color: Colors.white, + selected: currentRoute == '/', + clearStack: true, + ), + SizedBox(width: 15.0,), + TextLink( + S.of(context).download, + '/download', + color: Colors.white, + selected: currentRoute == '/download', + ), + SizedBox(width: 15.0,), + TextLink( + S.of(context).tutorials, + '/tutorials', + color: Colors.white, + selected: currentRoute == '/tutorials', + ), + SizedBox(width: 15.0,), + TextLink( + S.of(context).support, + '/support', + color: Colors.white, + selected: currentRoute == '/support', + ), + SizedBox(width: 15.0,), + TextLink( + S.of(context).shop, + '/shop', + color: Colors.white, + selected: currentRoute == '/shop', + ), + SizedBox(width: 15.0,), + TextLink( + S.of(context).blog, + '/blog', + color: Colors.white, + selected: currentRoute == '/blog', + ), + SizedBox(width: 15.0,), + TextLink( + S.of(context).login, + '/login', + color: Colors.white, + selected: currentRoute == '/login', + ), + ], ), - SizedBox(width: 15.0,), - TextLink( - S.of(context).download, - '/download', - color: Colors.white, - selected: currentRoute == '/download', - ), - SizedBox(width: 15.0,), - TextLink( - S.of(context).tutorials, - '/tutorials', - color: Colors.white, - selected: currentRoute == '/tutorials', - ), - SizedBox(width: 15.0,), - TextLink( - S.of(context).support, - '/support', - color: Colors.white, - selected: currentRoute == '/support', - ), - SizedBox(width: 15.0,), - TextLink( - S.of(context).shop, - '/shop', - color: Colors.white, - selected: currentRoute == '/shop', - ), - SizedBox(width: 15.0,), - TextLink( - S.of(context).blog, - '/blog', - color: Colors.white, - selected: currentRoute == '/blog', - ), - SizedBox(width: 15.0,), - TextLink( - S.of(context).login, - '/login', - color: Colors.white, - selected: currentRoute == '/login', - ), - ], + ), ), ), ], diff --git a/lib/widgets/general/bottom_nav.dart b/lib/widgets/general/bottom_nav.dart index e698eb4..25f97aa 100644 --- a/lib/widgets/general/bottom_nav.dart +++ b/lib/widgets/general/bottom_nav.dart @@ -38,7 +38,7 @@ class BottomNavState extends State { child: Text( 'All logos shown are registered trademark, copyrighted and belong to their respective owners.', style: TextStyle( - fontSize: 10.0, + fontSize: 8.0, color: Colors.white60, ), ), diff --git a/lib/widgets/general/download_apps.dart b/lib/widgets/general/download_apps.dart new file mode 100644 index 0000000..4204e18 --- /dev/null +++ b/lib/widgets/general/download_apps.dart @@ -0,0 +1,47 @@ + +import 'package:flutter/material.dart'; +import '../../utils/http_util.dart'; +import '../../widgets/desktop/desktop_download_apps.dart'; +import '../../widgets/mobile/mobile_download_apps.dart'; +import 'package:responsive_builder/responsive_builder.dart'; + +class DownloadApps extends StatefulWidget { + const DownloadApps({Key key}) : super(key: key); + + @override + State createState() { + return DownloadAppsState(); + } + +} + +class DownloadAppsState extends State { + Map data; + + @override + Widget build(BuildContext context) { + return ScreenTypeLayout( + mobile: MobileDownloadApps(data), + tablet: DesktopDownloadApps(data), + desktop: DesktopDownloadApps(data), + ); + } + + @override + void initState() { + super.initState(); + _loadData(); + } + + void _loadData() { + HttpUtil.httpGet('v1/get-wisetronic-download-page') + .then((value) { + print('$value'); + if (mounted) { + setState(() { + data = value; + }); + } + }); + } +} \ No newline at end of file diff --git a/lib/widgets/general/download_item.dart b/lib/widgets/general/download_item.dart index a232f11..9e74bc4 100644 --- a/lib/widgets/general/download_item.dart +++ b/lib/widgets/general/download_item.dart @@ -1,6 +1,14 @@ +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import '../../widgets/general/text_link.dart'; +import 'package:url_launcher/url_launcher.dart'; +import '../../generated/l10n.dart'; +import '../../utils/utils.dart'; +import '../../utils/extensions.dart'; import 'package:universal_io/io.dart'; +import '../../constants.dart'; import '../../utils/util_web.dart' if (dart.library.io) '../../utils/util_io.dart'; class DownloadItem extends StatefulWidget { @@ -16,15 +24,20 @@ class DownloadItem extends StatefulWidget { } class DownloadItemState extends State { + final double buttonWidth = 114.0; + final double iconWidth = 48.0; @override Widget build(BuildContext context) { - return Container( + width: widget.width ?? MediaQuery.of(context).size.width, padding: EdgeInsets.only(top: 10.0, bottom: 10.0, left: 10.0, right: 10.0), child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( + padding: EdgeInsets.symmetric(vertical: 5.0, horizontal: 10.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -32,15 +45,26 @@ class DownloadItemState extends State { child: Row( children: [ Container( - child: Util.showImage( - 'https:${widget.desc['app_icon']}', - width: 32.0, - height: 32.0, - fit: BoxFit.fill, + child: (kIsWeb) ? + Image.network( + '${widget.desc['app_icon']}', + ) : + SvgPicture.network( + '${widget.desc['app_icon']}', + placeholderBuilder: (BuildContext context) => Container( + padding: const EdgeInsets.all(30.0), + child: const CircularProgressIndicator(), + ), ), + width: iconWidth, + height: iconWidth, + margin: EdgeInsets.only(right: 16.0), ), Container( + width: widget.width != null ? widget.width - iconWidth - buttonWidth - 60 : MediaQuery.of(context).size.width - iconWidth - buttonWidth - 60, child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( '${widget.desc['name']}', @@ -49,6 +73,8 @@ class DownloadItemState extends State { fontSize: 15.0, color: Colors.black87, ), + maxLines: 2, + overflow: TextOverflow.ellipsis, ), Text( '${widget.desc['version']}', @@ -57,6 +83,7 @@ class DownloadItemState extends State { color: Colors.black38, ), ), + getSupportedOSs(), ], ), ), @@ -64,18 +91,19 @@ class DownloadItemState extends State { ), ), Container( + width: buttonWidth, child: getDownloadButton(), ), ], ), ), Container( + padding: EdgeInsets.symmetric(vertical: 5.0, horizontal: 10.0), child: Text( '${widget.desc['description']}', style: TextStyle( color: Colors.black54, ), - overflow: TextOverflow.ellipsis, ), ), ], @@ -83,8 +111,222 @@ class DownloadItemState extends State { ); } - Widget getDownloadButton() { + Widget getSupportedOSs() { + Row row = Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [], + ); + for (int i = 0; i < (widget.desc['urls'] as List).length; i++) { + switch((widget.desc['urls'] as List)[i]['os']) { + case 'windows': + row.children.add(Container( + margin: EdgeInsets.all(3.0), + child: Icon( + IconData( + Constants.FONT_WINDOWS, + fontFamily: 'wisetronic', + fontPackage: null + ), + color: Colors.green, + size: 20.0, + ), + )); + break; + case 'mac': + row.children.add(Container( + margin: EdgeInsets.all(3.0), + child: Icon( + IconData( + Constants.FONT_APPLE, + fontFamily: 'wisetronic', + fontPackage: null + ), + color: Colors.green, + size: 20.0, + ), + )); + break; + case 'ubuntu': + row.children.add(Container( + margin: EdgeInsets.all(3.0), + child: Icon( + IconData( + Constants.FONT_UBUNTU, + fontFamily: 'wisetronic', + fontPackage: null + ), + color: Colors.green, + size: 20.0, + ), + )); + break; + case 'android': + row.children.add(Container( + margin: EdgeInsets.all(3.0), + child: Icon( + IconData( + Constants.FONT_ANDROID, + fontFamily: 'wisetronic', + fontPackage: null + ), + color: Colors.green, + size: 20.0, + ), + )); + break; + case 'ios': + row.children.add(Container( + margin: EdgeInsets.all(3.0), + child: Icon( + IconData( + Constants.FONT_IOS, + fontFamily: 'wisetronic', + fontPackage: null + ), + color: Colors.green, + size: 20.0, + ), + )); + break; + } + } + return row; + } - return null; + Widget getDownloadButton() { + String downloadUrl; + String os = Utils.getOs(); + String selectedOs; + List supportedOss = []; + for (int i = 0; i < (widget.desc['urls'] as List).length; i++) { + supportedOss.add((widget.desc['urls'] as List)[i]['os']); + if ((widget.desc['urls'] as List)[i]['url'] == 'instore') { + downloadUrl = 'instore'; + } + if ((widget.desc['urls'] as List)[i]['os'] == os) { + selectedOs = (widget.desc['urls'] as List)[i]['os']; + downloadUrl = (widget.desc['urls'] as List)[i]['url']; + break; + } + } + print('download url $downloadUrl'); + if (downloadUrl != null && downloadUrl == 'instore') { + return Container( + padding: EdgeInsets.all(8.0), + child: Text( + S.of(context).install_in_store, + style: TextStyle( + color: Colors.black54, + fontSize: 11.5, + ), + textAlign: TextAlign.center, + ), + decoration: BoxDecoration( + // color: Colors.black54, + border: Border( + top: BorderSide( + width: 0.5, + color: Colors.black54, + ), + bottom: BorderSide( + width: 0.5, + color: Colors.black54, + ), + left: BorderSide( + width: 0.5, + color: Colors.black54, + ), + right: BorderSide( + width: 0.5, + color: Colors.black54, + ), + ), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(5.0), + topRight: Radius.circular(5.0), + bottomLeft: Radius.circular(5.0), + bottomRight: Radius.circular(5.0), + ), + ), + ); + } else if (downloadUrl != null && downloadUrl.isNotEmpty) { + return RaisedButton( + color: Theme.of(context).primaryColor, + padding: EdgeInsets.all(8.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + padding: EdgeInsets.only(right: 0.0, left: 6.0, top: 6.0, bottom: 6.0), + child: Icon( + IconData( + Utils.getOsFontHex(selectedOs), + fontFamily: 'wisetronic', + fontPackage: null + ), + color: Colors.white, + size: 18.0, + ), + ), + Container( + padding: EdgeInsets.all(6.0), + child: Text( + S.of(context).download, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + onPressed: () async { + if (await canLaunch(downloadUrl)) { + await launch('$downloadUrl'); + } + }, + ); + } else { + return Container( + padding: EdgeInsets.all(8.0), + child: Text( + S.of(context).download_with_token(supportedOss.join(', ').eachFirstCap), + style: TextStyle( + color: Colors.black54, + fontSize: 11.5, + ), + textAlign: TextAlign.center, + ), + decoration: BoxDecoration( + // color: Colors.black54, + border: Border( + top: BorderSide( + width: 0.5, + color: Colors.black54, + ), + bottom: BorderSide( + width: 0.5, + color: Colors.black54, + ), + left: BorderSide( + width: 0.5, + color: Colors.black54, + ), + right: BorderSide( + width: 0.5, + color: Colors.black54, + ), + ), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(5.0), + topRight: Radius.circular(5.0), + bottomLeft: Radius.circular(5.0), + bottomRight: Radius.circular(5.0), + ), + ), + ); + } } } \ No newline at end of file diff --git a/lib/widgets/general/navigationbar.dart b/lib/widgets/general/navigationbar.dart index d1c67cc..1133839 100644 --- a/lib/widgets/general/navigationbar.dart +++ b/lib/widgets/general/navigationbar.dart @@ -7,11 +7,15 @@ import 'package:responsive_builder/responsive_builder.dart'; class NavigationBar extends StatefulWidget implements PreferredSizeWidget { final Key key; final PreferredSizeWidget bottom; + final String title; + final bool back; - NavigationBar({Key key, PreferredSizeWidget bottom}) + NavigationBar({Key key, PreferredSizeWidget bottom, String title, bool back}) : key = key, preferredSize = Size.fromHeight(kToolbarHeight + (bottom?.preferredSize?.height ?? 0.0)), - bottom = bottom; + bottom = bottom, + title = title ?? '', + back = back ?? false; @override final Size preferredSize; @@ -28,7 +32,7 @@ class NavigationBarState extends State { @override Widget build(BuildContext context) { return ScreenTypeLayout( - mobile: MobileNavigationBar(), + mobile: MobileNavigationBar(title: widget.title, back: widget.back,), tablet: DesktopNavigationBar(), desktop: DesktopNavigationBar(), ); diff --git a/lib/widgets/general/navigationbar_logo.dart b/lib/widgets/general/navigationbar_logo.dart index c76f73b..2d674b3 100644 --- a/lib/widgets/general/navigationbar_logo.dart +++ b/lib/widgets/general/navigationbar_logo.dart @@ -1,11 +1,13 @@ import 'package:flutter/material.dart'; +import '../../constants.dart'; + class NavigationBarLogo extends StatelessWidget { const NavigationBarLogo({Key key}) : super(key: key); static const IconData logoData = IconData( - 0xe800, + Constants.FONT_WISETRONIC, fontFamily: 'wisetronic', fontPackage: null ); diff --git a/lib/widgets/general/text_link.dart b/lib/widgets/general/text_link.dart index b40971c..b34e195 100644 --- a/lib/widgets/general/text_link.dart +++ b/lib/widgets/general/text_link.dart @@ -1,8 +1,11 @@ +import 'package:fluro/fluro.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:url_launcher/url_launcher.dart'; +import '../../routes.dart'; + class TextLink extends StatelessWidget { final String title; final String url; @@ -11,13 +14,33 @@ class TextLink extends StatelessWidget { final double paddingVertical; final FontWeight fontWeight; final bool selected; + final bool isLink; + final bool replace; + final bool clearStack; + final bool maintainState; + final bool rootNavigator; + final TransitionType transition; + final bool closeDrawer; TextLink(this.title, this.url, { this.color, this.paddingHorizontal, this.paddingVertical, this.fontWeight, - this.selected - }); + this.selected, + bool isLink, + bool replace, + bool clearStack, + bool maintainState, + bool rootNavigator, + this.transition, + bool closeDrawer, + }) : + isLink = isLink ?? false, + replace = replace ?? false, + clearStack = clearStack ?? false, + maintainState = maintainState ?? true, + rootNavigator = rootNavigator ?? false, + closeDrawer = closeDrawer ?? false; @override Widget build(BuildContext context) { @@ -46,10 +69,23 @@ class TextLink extends StatelessWidget { ), ), onTap: () async { - if (await canLaunch(url)) { - await launch(url); + if (!isLink) { + if (closeDrawer) { + Routes.router.pop(context); + } + Routes.router.navigateTo( + context, url, + replace: replace, + clearStack: clearStack, + maintainState: maintainState, + rootNavigator: rootNavigator, + ); } else { - throw 'Could not launch $url'; + if (await canLaunch(url)) { + await launch(url); + } else { + throw 'Could not launch $url'; + } } }, ), diff --git a/lib/widgets/mobile/mobile_download_apps.dart b/lib/widgets/mobile/mobile_download_apps.dart new file mode 100644 index 0000000..e341feb --- /dev/null +++ b/lib/widgets/mobile/mobile_download_apps.dart @@ -0,0 +1,61 @@ + +import 'package:flutter/material.dart'; +import 'package:flutter_wisetronic/widgets/general/download_item.dart'; +import '../../store/store.dart'; +import '../../utils/util_web.dart' if (dart.library.io) '../../utils/util_io.dart'; + +class MobileDownloadApps extends StatefulWidget { + final Map data; + + MobileDownloadApps(this.data, {Key key}) : super(key: key); + + @override + State createState() { + return MobileDownloadAppsState(); + } + +} + +class MobileDownloadAppsState extends State { + @override + Widget build(BuildContext context) { + if (widget.data == null) { + return Container(); + } + Column col = Column( + children: [ + Container( + child: Util.showImage( + 'https:${widget.data['download-image']['image']}' + ), + ), + ], + ); + List apps = _getApps(); + for (int i = 0; i < apps.length; i++) { + col.children.add(apps[i]); + } + return col; + } + + List _getApps() { + List apps = []; + for (int i = 0; i < (widget.data['apps'] as List).length; i++) { + apps.add(DownloadItem((widget.data['apps'] as List)[i], width: MediaQuery.of(context).size.width,)); + if (i + 1 < (widget.data['apps'] as List).length) { + apps.add(Container( + padding: EdgeInsets.only(top: 10.0, bottom: 5.0), + decoration: BoxDecoration( + border: Border( + top: BorderSide( + width: 0.5, + color: Colors.black38, + ), + ), + ), + )); + } + } + return apps; + } +} \ No newline at end of file diff --git a/lib/widgets/mobile/mobile_index_main_content_2.dart b/lib/widgets/mobile/mobile_index_main_content_2.dart index 3f36a20..53041bb 100644 --- a/lib/widgets/mobile/mobile_index_main_content_2.dart +++ b/lib/widgets/mobile/mobile_index_main_content_2.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:flutter_wisetronic/generated/l10n.dart'; +import '../../generated/l10n.dart'; +import '../../widgets/general/text_link.dart'; import '../../utils/util_web.dart' if (dart.library.io) '../../utils/util_io.dart'; class MobileIndexMainContent2 extends StatefulWidget { @@ -97,16 +98,11 @@ class MobileIndexMainContent2State extends State { )); } col.children.add( - GestureDetector( - child: Container( - padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 0.0), - child: Text( - S.of(context).learn_more, - style: TextStyle( - color: Colors.blue, - fontWeight: FontWeight.bold, - ), - ), + Container( + alignment: Alignment.centerRight, + child: TextLink( + S.of(context).learn_more, + '/minipos-learn-more', ), ), ); diff --git a/lib/widgets/mobile/mobile_index_main_content_3.dart b/lib/widgets/mobile/mobile_index_main_content_3.dart index 25a8695..291feea 100644 --- a/lib/widgets/mobile/mobile_index_main_content_3.dart +++ b/lib/widgets/mobile/mobile_index_main_content_3.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:flutter_wisetronic/generated/l10n.dart'; +import '../../generated/l10n.dart'; +import '../../widgets/general/text_link.dart'; import '../../utils/util_web.dart' if (dart.library.io) '../../utils/util_io.dart'; class MobileIndexMainContent3 extends StatefulWidget { @@ -100,16 +101,11 @@ class MobileIndexMainContent3State extends State { )); } col.children.add( - GestureDetector( - child: Container( - padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 0.0), - child: Text( - S.of(context).learn_more, - style: TextStyle( - color: Colors.blue, - fontWeight: FontWeight.bold, - ), - ), + Container( + alignment: Alignment.centerRight, + child: TextLink( + S.of(context).learn_more, + '/igoshow-learn-more', ), ), ); diff --git a/lib/widgets/mobile/mobile_navigation_drawer.dart b/lib/widgets/mobile/mobile_navigation_drawer.dart index 4e34596..6e4c8a0 100644 --- a/lib/widgets/mobile/mobile_navigation_drawer.dart +++ b/lib/widgets/mobile/mobile_navigation_drawer.dart @@ -4,6 +4,8 @@ import 'package:flutter_wisetronic/generated/l10n.dart'; import 'package:flutter_wisetronic/widgets/general/text_link.dart'; import 'package:flutter_wisetronic/widgets/mobile/mobile_navigation_drawer_header.dart'; +import '../../constants.dart'; + class MobileNavigationDrawer extends StatefulWidget { const MobileNavigationDrawer({Key key}) : super(key: key); @@ -20,7 +22,7 @@ class MobileNavigationDrawerState extends State { String currentRoute = ModalRoute.of(context).settings.name; return Container( - width: 300.0, + width: 200.0, height: MediaQuery.of(context).size.height, decoration: BoxDecoration( color: Colors.white, @@ -38,6 +40,8 @@ class MobileNavigationDrawerState extends State { paddingVertical: 10.0, paddingHorizontal: 15.0, selected: currentRoute == '/', + closeDrawer: true, + clearStack: true, ), TextLink( S.of(context).download, @@ -45,6 +49,7 @@ class MobileNavigationDrawerState extends State { paddingVertical: 10.0, paddingHorizontal: 15.0, selected: currentRoute == '/download', + closeDrawer: true, ), TextLink( S.of(context).tutorials, @@ -52,6 +57,7 @@ class MobileNavigationDrawerState extends State { paddingVertical: 10.0, paddingHorizontal: 15.0, selected: currentRoute == '/tutorials', + closeDrawer: true, ), TextLink( S.of(context).support, @@ -59,6 +65,7 @@ class MobileNavigationDrawerState extends State { paddingVertical: 10.0, paddingHorizontal: 15.0, selected: currentRoute == '/support', + closeDrawer: true, ), TextLink( S.of(context).shop, @@ -66,6 +73,7 @@ class MobileNavigationDrawerState extends State { paddingVertical: 10.0, paddingHorizontal: 15.0, selected: currentRoute == '/shop', + closeDrawer: true, ), TextLink( S.of(context).blog, @@ -73,6 +81,7 @@ class MobileNavigationDrawerState extends State { paddingVertical: 10.0, paddingHorizontal: 15.0, selected: currentRoute == '/blog', + closeDrawer: true, ), TextLink( S.of(context).login, @@ -80,6 +89,7 @@ class MobileNavigationDrawerState extends State { paddingVertical: 10.0, paddingHorizontal: 15.0, selected: currentRoute == '/login', + closeDrawer: true, ), Container( margin: EdgeInsets.only(top: 20.0), @@ -102,24 +112,28 @@ class MobileNavigationDrawerState extends State { '/service_policy', paddingVertical: 5.0, paddingHorizontal: 10.0, + closeDrawer: true, ), TextLink( S.of(context).return_policy, '/return_policy', paddingVertical: 5.0, paddingHorizontal: 10.0, + closeDrawer: true, ), TextLink( S.of(context).privacy_policy, '/privacy_policy', paddingVertical: 5.0, paddingHorizontal: 10.0, + closeDrawer: true, ), TextLink( S.of(context).license_agreement, '/license_agreement', paddingVertical: 5.0, paddingHorizontal: 10.0, + closeDrawer: true, ), Container( margin: EdgeInsets.only(top: 20.0, bottom: 10.0), @@ -132,11 +146,11 @@ class MobileNavigationDrawerState extends State { ), ), ), - TextLink(S.of(context).wiki, '/wiki', paddingVertical: 5.0, paddingHorizontal: 10.0,), - TextLink(S.of(context).support_ticket, '/support_ticket', paddingVertical: 5.0, paddingHorizontal: 10.0,), - TextLink(S.of(context).contact_us, '/contact_us', paddingVertical: 5.0, paddingHorizontal: 10.0,), - TextLink(S.of(context).about_us, '/about_us', paddingVertical: 5.0, paddingHorizontal: 10.0,), - TextLink(S.of(context).renew_license, '/renew_license', paddingVertical: 5.0, paddingHorizontal: 10.0,), + TextLink(S.of(context).wiki, '/wiki', paddingVertical: 5.0, paddingHorizontal: 10.0, closeDrawer: true,), + TextLink(S.of(context).support_ticket, '/support_ticket', paddingVertical: 5.0, paddingHorizontal: 10.0, closeDrawer: true,), + TextLink(S.of(context).contact_us, '/contact_us', paddingVertical: 5.0, paddingHorizontal: 10.0, closeDrawer: true,), + TextLink(S.of(context).about_us, '/about_us', paddingVertical: 5.0, paddingHorizontal: 10.0, closeDrawer: true,), + TextLink(S.of(context).renew_license, '/renew_license', paddingVertical: 5.0, paddingHorizontal: 10.0, closeDrawer: true,), Container( margin: EdgeInsets.only(top: 20.0, bottom: 10.0), child: Text( @@ -154,8 +168,8 @@ class MobileNavigationDrawerState extends State { padding: EdgeInsets.all(10.0), child: Icon( IconData( - 0xe800, - fontFamily: 'company', + Constants.FONT_GOOGLE, + fontFamily: 'wisetronic', fontPackage: null ), color: Colors.black26, @@ -166,8 +180,8 @@ class MobileNavigationDrawerState extends State { padding: EdgeInsets.all(10.0), child: Icon( IconData( - 0xe801, - fontFamily: 'company', + Constants.FONT_ALEXA, + fontFamily: 'wisetronic', fontPackage: null ), color: Colors.black26, @@ -178,8 +192,8 @@ class MobileNavigationDrawerState extends State { padding: EdgeInsets.all(10.0), child: Icon( IconData( - 0xe802, - fontFamily: 'company', + Constants.FONT_APPLE, + fontFamily: 'wisetronic', fontPackage: null ), color: Colors.black26, @@ -190,8 +204,8 @@ class MobileNavigationDrawerState extends State { padding: EdgeInsets.all(10.0), child: Icon( IconData( - 0xe803, - fontFamily: 'company', + Constants.FONT_EBAY, + fontFamily: 'wisetronic', fontPackage: null ), color: Colors.black26, @@ -202,8 +216,8 @@ class MobileNavigationDrawerState extends State { padding: EdgeInsets.all(10.0), child: Icon( IconData( - 0xe804, - fontFamily: 'company', + Constants.FONT_QUICKBOOKS, + fontFamily: 'wisetronic', fontPackage: null ), color: Colors.black26, @@ -214,8 +228,8 @@ class MobileNavigationDrawerState extends State { padding: EdgeInsets.all(10.0), child: Icon( IconData( - 0xe805, - fontFamily: 'company', + Constants.FONT_SHOPIFY, + fontFamily: 'wisetronic', fontPackage: null ), color: Colors.black26, diff --git a/lib/widgets/mobile/mobile_navigation_drawer_header.dart b/lib/widgets/mobile/mobile_navigation_drawer_header.dart index f59e44e..4f6956c 100644 --- a/lib/widgets/mobile/mobile_navigation_drawer_header.dart +++ b/lib/widgets/mobile/mobile_navigation_drawer_header.dart @@ -8,11 +8,12 @@ class MobileNavigationDrawerHeader extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - height: 40.0, - padding: EdgeInsets.only(top: 10.0), + height: kToolbarHeight + 30.0, + padding: EdgeInsets.only(top: 16.0, bottom: 16.0), color: Colors.green, alignment: Alignment.center, child: Column( + mainAxisAlignment: MainAxisAlignment.end, children: [ Text( S.of(context).navigation, diff --git a/lib/widgets/mobile/mobile_navigationbar.dart b/lib/widgets/mobile/mobile_navigationbar.dart index 123bb5c..4b6e02e 100644 --- a/lib/widgets/mobile/mobile_navigationbar.dart +++ b/lib/widgets/mobile/mobile_navigationbar.dart @@ -4,8 +4,12 @@ import 'package:flutter_wisetronic/events/eventbus.dart'; import 'package:flutter_wisetronic/events/events.dart'; import 'package:flutter_wisetronic/widgets/general/navigationbar_logo.dart'; +import '../../routes.dart'; + class MobileNavigationBar extends StatefulWidget { - const MobileNavigationBar({Key key}) : super(key: key); + final String title; + final bool back; + const MobileNavigationBar({Key key, this.title, this.back}) : super(key: key); @override State createState() { @@ -18,57 +22,43 @@ class MobileNavigationBarState extends State { @override Widget build(BuildContext context) { - return Container( - padding: EdgeInsets.only(left: 10.0, right: 10.0), - height: 80.0, - color: Colors.blue, - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - IconButton( - icon: Icon(Icons.menu), - onPressed: () { - eventBus.fire(OpenDrawer()); - }, - ), - Container( - child: NavigationBarLogo(), - padding: EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0, bottom: 5.0), - ), - Container() - ], + return AppBar( + leading: widget.back ? + IconButton( + icon: Icon( + Icons.arrow_back_ios, + color: Colors.white, + ), + onPressed: () { + Routes.router.pop(context); + }, + ) : + IconButton( + icon: Icon( + Icons.menu, + color: Colors.white, + ), + onPressed: () { + eventBus.fire(OpenDrawer()); + }, ), + title: Container( + child: widget.title.isNotEmpty ? + Container( + child: Text( + '${widget.title}', + style: TextStyle( + color: Colors.white, + fontSize: 24.0, + fontWeight: FontWeight.bold, + ), + ), + ) : + NavigationBarLogo(), + padding: EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0, bottom: 5.0), + ), + centerTitle: true, ); - // return Stack( - // children: [ - // Container( - // height: 80.0, - // color: Colors.blue, - // ), - // Container( - // padding: EdgeInsets.only(left: 10.0, right: 10.0), - // height: 80.0, - // child: Row( - // mainAxisSize: MainAxisSize.max, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // IconButton( - // icon: Icon(Icons.menu), - // onPressed: () { - // - // }, - // ), - // Container( - // child: NavigationBarLogo(), - // padding: EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0, bottom: 5.0), - // ), - // Container() - // ], - // ), - // ), - // ], - // ); } } \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index 00c8da5..3ae1f4f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -42,7 +42,7 @@ packages: name: cached_network_image url: "https://pub.dartlang.org" source: hosted - version: "2.4.1" + version: "2.5.0" carousel_slider: dependency: "direct main" description: @@ -133,7 +133,7 @@ packages: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "1.0.1+1" + version: "1.0.2" device_info: dependency: transitive description: @@ -222,7 +222,7 @@ packages: name: flutter_cache_manager url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" flutter_device_locale: dependency: "direct main" description: @@ -283,7 +283,7 @@ packages: name: flutter_staggered_grid_view url: "https://pub.dartlang.org" source: hosted - version: "0.3.2" + version: "0.3.3" flutter_svg: dependency: "direct main" description: @@ -307,7 +307,7 @@ packages: name: fluttertoast url: "https://pub.dartlang.org" source: hosted - version: "7.1.5" + version: "7.1.6" hive: dependency: "direct main" description: @@ -545,7 +545,7 @@ packages: name: rxdart url: "https://pub.dartlang.org" source: hosted - version: "0.24.1" + version: "0.25.0" searchable_dropdown: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 3056d78..fb11bc4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -53,7 +53,7 @@ dependencies: flutter_launcher_icons: ^0.8.1 flutter_device_locale: ^0.4.0 package_info: ^0.4.3+2 - catcher: ^0.3.22 + catcher: ^0.3.23 share: ^0.6.5+4 flutter_svg: ^0.19.2+1 universal_io: ^1.0.1 @@ -95,9 +95,6 @@ flutter: - family: wisetronic fonts: - asset: fonts/wisetronic.ttf - - family: company - fonts: - - asset: fonts/company.ttf # fonts: # - family: Schyler # fonts: