backup.
This commit is contained in:
76
lib/widgets/desktop/desktop_download_apps.dart
Normal file
76
lib/widgets/desktop/desktop_download_apps.dart
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
|
||||
47
lib/widgets/general/download_apps.dart
Normal file
47
lib/widgets/general/download_apps.dart
Normal 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;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
);
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
61
lib/widgets/mobile/mobile_download_apps.dart
Normal file
61
lib/widgets/mobile/mobile_download_apps.dart
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -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',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -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',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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()
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user