This commit is contained in:
2020-12-28 00:19:04 -05:00
parent 86c845b49b
commit c378a6203c
33 changed files with 833 additions and 200 deletions

View File

@@ -1,5 +1,20 @@
class Constants {
static const int FONT_GOOGLE = 0xe800;
static const int FONT_ALEXA = 0xe801;
static const int FONT_APPLE = 0xe802;
static const int FONT_EBAY = 0xe803;
static const int FONT_QUICKBOOKS = 0xe804;
static const int FONT_SHOPIFY = 0xe805;
static const int FONT_MINIPOS = 0xe807;
static const int FONT_WINDOWS = 0xe80a;
static const int FONT_ANDROID = 0xe80b;
static const int FONT_APPLE_LOGO = 0xe80c;
static const int FONT_IOS = 0xe80d;
static const int FONT_UBUNTU = 0xe80e;
static const int FONT_WISETRONIC = 0xe812;
static const int FONT_TOPTONS = 0xe813;
static const bool DEBUG = false;
static const BASE_API_URL = 'https://api.minipos.us/';
static const String API_SECRET = 'pei326sami1223HellowWorldabcdEd';

View File

@@ -19,6 +19,8 @@ typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'en';
static m0(oss) => "Download at ${oss}";
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"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..."),

View File

@@ -19,6 +19,8 @@ typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'zh_CN';
static m0(oss) => "${oss}下载";
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"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("装载中,清稍候..."),

View File

@@ -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<S> {

View File

@@ -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"
}

View File

@@ -28,5 +28,7 @@
"shop": "线上购买",
"blog": "博客",
"login": "登入",
"logout": "登出"
"logout": "登出",
"download_with_token": "在{oss}下载",
"install_in_store": "店内安装"
}

View File

@@ -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<Locale> supportedLocales) {
print('Language code: ${localLocate.languageCode}');
for (final supportedLocale in supportedLocales) {
return supportedLocale;
if (supportedLocale.languageCode == localLocate.languageCode) {
return supportedLocale;
}
}
return supportedLocales.first;
},

57
lib/pages/download.dart Normal file
View File

@@ -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<StatefulWidget> createState() {
return DownloadState();
}
}
class DownloadState extends State<Download> {
final _scaffoldKey = GlobalKey<ScaffoldState>();
@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<OpenDrawer>().listen((event) {
if (mounted) {
_scaffoldKey.currentState.openDrawer();
}
});
}
}

View File

@@ -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<StatefulWidget> createState() {

View File

@@ -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<String, List<String>> params) {
return null;
return Home(null);
}),
transitionType: TransitionType.fadeIn
);
router.define('/download', handler: new Handler(
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
return Download();
}),
transitionType: TransitionType.inFromRight
);
}
}

View File

@@ -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(" ");
}

View File

@@ -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<dynamic> httpGet(String url,

View File

@@ -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{

View File

@@ -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<String, dynamic> data;
DesktopDownloadApps(this.data, {Key key}) : super(key: key);
@override
State<StatefulWidget> createState() {
return DesktopDownloadAppsState();
}
}
class DesktopDownloadAppsState extends State<DesktopDownloadApps> {
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<Widget> 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<Widget> _getApps() {
List<Widget> 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;
}
}

View File

@@ -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<String, dynamic> content;
const DesktopIndexMainContent3(this.content, {Key key}) : super(key: key);
@@ -100,8 +102,8 @@ class DesktopIndexMainContent3State extends State<DesktopIndexMainContent3> {
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<DesktopIndexMainContent3> {
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<DesktopIndexMainContent3> {
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<DesktopIndexMainContent3> {
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<DesktopIndexMainContent3> {
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<DesktopIndexMainContent3> {
padding: EdgeInsets.all(10.0),
child: Icon(
IconData(
0xe805,
fontFamily: 'company',
Constants.FONT_SHOPIFY,
fontFamily: 'wisetronic',
fontPackage: null
),
color: Colors.white24,

View File

@@ -33,60 +33,68 @@ class DesktopNavigationBarState extends State<DesktopNavigationBar> {
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',
),
],
),
),
),
],

View File

@@ -38,7 +38,7 @@ class BottomNavState extends State<BottomNav> {
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,
),
),

View File

@@ -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<StatefulWidget> createState() {
return DownloadAppsState();
}
}
class DownloadAppsState extends State<DownloadApps> {
Map<String, dynamic> 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;
});
}
});
}
}

View File

@@ -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<DownloadItem> {
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<DownloadItem> {
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<DownloadItem> {
fontSize: 15.0,
color: Colors.black87,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
Text(
'${widget.desc['version']}',
@@ -57,6 +83,7 @@ class DownloadItemState extends State<DownloadItem> {
color: Colors.black38,
),
),
getSupportedOSs(),
],
),
),
@@ -64,18 +91,19 @@ class DownloadItemState extends State<DownloadItem> {
),
),
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<DownloadItem> {
);
}
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<String> 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),
),
),
);
}
}
}

View File

@@ -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<NavigationBar> {
@override
Widget build(BuildContext context) {
return ScreenTypeLayout(
mobile: MobileNavigationBar(),
mobile: MobileNavigationBar(title: widget.title, back: widget.back,),
tablet: DesktopNavigationBar(),
desktop: DesktopNavigationBar(),
);

View File

@@ -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
);

View File

@@ -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';
}
}
},
),

View File

@@ -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<String, dynamic> data;
MobileDownloadApps(this.data, {Key key}) : super(key: key);
@override
State<StatefulWidget> createState() {
return MobileDownloadAppsState();
}
}
class MobileDownloadAppsState extends State<MobileDownloadApps> {
@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<Widget> apps = _getApps();
for (int i = 0; i < apps.length; i++) {
col.children.add(apps[i]);
}
return col;
}
List<Widget> _getApps() {
List<Widget> 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;
}
}

View File

@@ -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<MobileIndexMainContent2> {
));
}
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',
),
),
);

View File

@@ -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<MobileIndexMainContent3> {
));
}
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',
),
),
);

View File

@@ -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<MobileNavigationDrawer> {
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<MobileNavigationDrawer> {
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<MobileNavigationDrawer> {
paddingVertical: 10.0,
paddingHorizontal: 15.0,
selected: currentRoute == '/download',
closeDrawer: true,
),
TextLink(
S.of(context).tutorials,
@@ -52,6 +57,7 @@ class MobileNavigationDrawerState extends State<MobileNavigationDrawer> {
paddingVertical: 10.0,
paddingHorizontal: 15.0,
selected: currentRoute == '/tutorials',
closeDrawer: true,
),
TextLink(
S.of(context).support,
@@ -59,6 +65,7 @@ class MobileNavigationDrawerState extends State<MobileNavigationDrawer> {
paddingVertical: 10.0,
paddingHorizontal: 15.0,
selected: currentRoute == '/support',
closeDrawer: true,
),
TextLink(
S.of(context).shop,
@@ -66,6 +73,7 @@ class MobileNavigationDrawerState extends State<MobileNavigationDrawer> {
paddingVertical: 10.0,
paddingHorizontal: 15.0,
selected: currentRoute == '/shop',
closeDrawer: true,
),
TextLink(
S.of(context).blog,
@@ -73,6 +81,7 @@ class MobileNavigationDrawerState extends State<MobileNavigationDrawer> {
paddingVertical: 10.0,
paddingHorizontal: 15.0,
selected: currentRoute == '/blog',
closeDrawer: true,
),
TextLink(
S.of(context).login,
@@ -80,6 +89,7 @@ class MobileNavigationDrawerState extends State<MobileNavigationDrawer> {
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<MobileNavigationDrawer> {
'/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<MobileNavigationDrawer> {
),
),
),
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<MobileNavigationDrawer> {
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<MobileNavigationDrawer> {
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<MobileNavigationDrawer> {
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<MobileNavigationDrawer> {
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<MobileNavigationDrawer> {
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<MobileNavigationDrawer> {
padding: EdgeInsets.all(10.0),
child: Icon(
IconData(
0xe805,
fontFamily: 'company',
Constants.FONT_SHOPIFY,
fontFamily: 'wisetronic',
fontPackage: null
),
color: Colors.black26,

View File

@@ -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,

View File

@@ -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<StatefulWidget> createState() {
@@ -18,57 +22,43 @@ class MobileNavigationBarState extends State<MobileNavigationBar> {
@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()
// ],
// ),
// ),
// ],
// );
}
}