initial commit to gitea

This commit is contained in:
2022-03-10 00:47:26 -05:00
parent 808ffa3211
commit f504e213a0
93 changed files with 4394 additions and 1539 deletions

View File

@@ -19,8 +19,10 @@ import '../widgets/mobile/mobile_renew_license.dart';
class BuyService extends StatefulWidget {
final int gid;
final String serviceName;
final String domain;
final int sid;
const BuyService(this.gid, this.serviceName, {Key key}) :
const BuyService(this.gid, this.serviceName, {Key key, this.domain, this.sid = 0}) :
super(key: key);
@override
@@ -66,8 +68,13 @@ class BuyServiceState extends State<BuyService> {
HttpUtil.httpGet(
'v1/get-buy-service-info/${widget.serviceName}/${widget.gid}',
businessId: Constants.BUSINESS_ID,
queryParameters: {
'store_id': '${widget.sid}',
}
).then((value) {
data = value;
data['domain'] = widget.domain;
print('data: $data');
setState(() {});
}).onError((error, stackTrace) {
Utils.showMessageDialog(context, error);

View File

@@ -22,7 +22,7 @@ class ChangeMobileOrEmail extends StatelessWidget {
return ResponsiveBuilder(
builder: (context, sizingInformation) =>
Scaffold(
appBar: NavigationBar(
appBar: MiniNavigationBar(
title: isMobile ? S.of(context).change_mobile : S.of(context).change_email,
back: true,
breadCrumbs: [

View File

@@ -20,7 +20,7 @@ class ChangePassword extends StatelessWidget {
builder: (context, sizingInformation) =>
Scaffold(
key: _scaffoldKey,
appBar: NavigationBar(
appBar: MiniNavigationBar(
title: S.of(context).change_password,
back: true,
breadCrumbs: [

View File

@@ -0,0 +1,48 @@
import 'package:flutter/material.dart';
import 'package:flutter_wisetronic/store/actions.dart';
import 'package:flutter_wisetronic/store/store.dart';
import 'package:responsive_builder/responsive_builder.dart';
import '../constants.dart';
import '../routes.dart';
import '../widgets/desktop/create_online_store_1.dart' as desktop;
import '../widgets/mobile/create_online_store_1.dart' as mobile;
class CreateOnlineStore1 extends StatefulWidget {
const CreateOnlineStore1({Key key}) :
super(key: key);
@override
State<StatefulWidget> createState() => CreateOnlineStore1State();
}
class CreateOnlineStore1State extends State<CreateOnlineStore1> {
@override
Widget build(BuildContext context) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
if (store.state.user == null) {
store.dispatch(UpdateRedirectRoute('/contact-stores'));
Routes.router.navigateTo(context, '/login', replace: true);
return;
}
});
return ResponsiveBuilder(
builder: (context, sizingInformation) =>
ScreenTypeLayout(
mobile: mobile.CreateOnlineStore1(Constants.BUSINESS_ID),
tablet: desktop.CreateOnlineStore1(Constants.BUSINESS_ID),
desktop: desktop.CreateOnlineStore1(Constants.BUSINESS_ID),
),
);
}
@override
void initState() {
super.initState();
}
}

View File

@@ -50,7 +50,7 @@ class DownloadState extends State<Download> {
builder: (context, sizingInformation) =>
Scaffold(
key: _scaffoldKey,
appBar: NavigationBar(
appBar: MiniNavigationBar(
title: S.of(context).download,
back: true,
breadCrumbs: [BreadCrumb(S.of(context).downloads, null)],

View File

@@ -19,7 +19,7 @@ class ForgotPassword extends StatelessWidget {
return ResponsiveBuilder(
builder: (context, sizingInformation) =>
Scaffold(
appBar: NavigationBar(
appBar: MiniNavigationBar(
title: S.of(context).forgot_password,
back: true,
breadCrumbs: [

View File

@@ -70,7 +70,7 @@ class HomeState extends State<Home> {
builder: (context, sizingInformation) =>
Scaffold(
key: _scaffoldKey,
appBar: NavigationBar(),
appBar: MiniNavigationBar(),
drawer: sizingInformation.deviceScreenType == DeviceScreenType.mobile ? MobileNavigationDrawer() : null,
body: DoubleBackToCloseAppWrapper(
child: ScreenTypeLayout(

View File

@@ -46,7 +46,7 @@ class IGoShowLearnMoreState extends State<IGoShowLearnMore> {
builder: (context, sizingInformation) =>
Scaffold(
key: _scaffoldKey,
appBar: NavigationBar(
appBar: MiniNavigationBar(
title: S.of(context).igoshow,
back: true,
breadCrumbs: [

View File

@@ -41,7 +41,7 @@ class LoginState extends State<Login> {
builder: (context, sizingInformation) =>
Scaffold(
key: _scaffoldKey,
appBar: NavigationBar(
appBar: MiniNavigationBar(
title: S.of(context).login,
back: true,
breadCrumbs: [

View File

@@ -42,7 +42,7 @@ class MeState extends State<Me> {
builder: (context, sizingInformation) =>
Scaffold(
key: _scaffoldKey,
appBar: sizingInformation.isMobile? null : NavigationBar(
appBar: sizingInformation.isMobile? null : MiniNavigationBar(
title: S.of(context).me,
back: true,
breadCrumbs: [

View File

@@ -47,7 +47,7 @@ class MiniPosLearnMoreState extends State<MiniPosLearnMore> {
builder: (context, sizingInformation) =>
Scaffold(
key: _scaffoldKey,
appBar: NavigationBar(
appBar: MiniNavigationBar(
title: S.of(context).minipos,
back: true,
breadCrumbs: [

View File

@@ -43,7 +43,7 @@ class NewTicketState extends State<NewTicket> {
builder: (context, sizingInformation) =>
Scaffold(
key: _scaffoldKey,
appBar: NavigationBar(
appBar: MiniNavigationBar(
title: S.of(context).new_ticket,
back: true,
breadCrumbs: [

View File

@@ -19,7 +19,7 @@ class NewUser extends StatelessWidget {
return ResponsiveBuilder(
builder: (context, sizingInformation) =>
Scaffold(
appBar: NavigationBar(
appBar: MiniNavigationBar(
title: S.of(context).registration,
back: true,
breadCrumbs: [

View File

@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'package:flutter_wisetronic/models/business.dart';
import 'package:responsive_builder/responsive_builder.dart';
import '../widgets/desktop/product_search.dart' as desktop;
import '../widgets/mobile/product_search.dart' as mobile;
class ProductSearch extends StatelessWidget {
final Business business;
const ProductSearch(this.business, {Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return ResponsiveBuilder(
builder: (context, sizingInformation) =>
ScreenTypeLayout(
mobile: mobile.ProductSearch(business),
tablet: desktop.ProductSearch(business),
desktop: desktop.ProductSearch(business),
),
);
}
}

View File

@@ -21,7 +21,7 @@ class ResetPassword extends StatelessWidget {
return ResponsiveBuilder(
builder: (context, sizingInformation) =>
Scaffold(
appBar: NavigationBar(
appBar: MiniNavigationBar(
title: S.of(context).reset_password,
back: true,
breadCrumbs: [

View File

@@ -21,7 +21,7 @@ class SetPassword extends StatelessWidget {
return ResponsiveBuilder(
builder: (context, sizingInformation) =>
Scaffold(
appBar: NavigationBar(
appBar: MiniNavigationBar(
title: S.of(context).set_password,
back: true,
breadCrumbs: [

View File

@@ -1,55 +1,44 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_wisetronic/events/eventbus.dart';
import 'package:flutter_wisetronic/events/events.dart';
import 'package:flutter_wisetronic/generated/l10n.dart';
import 'package:flutter_wisetronic/models/cart_info.dart';
import 'package:flutter_wisetronic/models/cart_line_item.dart';
import 'package:flutter_wisetronic/models/product.dart';
import 'package:flutter_wisetronic/utils/utils.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:responsive_builder/responsive_builder.dart';
import '../constants.dart';
import '../store/actions.dart';
import '../store/store.dart';
import '../widgets/desktop/desktop_shop.dart';
import '../widgets/mobile/mobile_shop.dart';
import '../../utils/utils.dart';
import '../widgets/desktop/shop.dart' as desktop;
import '../widgets/mobile/shop.dart' as mobile;
class Shop extends StatefulWidget {
final int businessId;
const Shop({this.businessId = Constants.BUSINESS_ID, Key key}) :
super(key: key);
const Shop({this.businessId, Key key}) : super(key: key);
@override
State<StatefulWidget> createState() => ShopState();
}
class ShopState extends State<Shop> {
StreamSubscription onProductWillAddToCartSubscription;
StreamSubscription onProductWillRemoveFromCartSubscription;
@override
Widget build(BuildContext context) {
store.dispatch(UpdateContext(context));
int _businessId =
widget.businessId == null ? Utils.getBusinessId() : widget.businessId;
return ResponsiveBuilder(
builder: (context, sizingInformation) =>
ScreenTypeLayout(
mobile: MobileShop(businessId: widget.businessId,),
tablet: DesktopShop(businessId: widget.businessId,),
desktop: DesktopShop(businessId: widget.businessId,),
),
builder: (context, sizingInformation) => ScreenTypeLayout(
mobile: mobile.Shop(
businessId: _businessId,
),
tablet: desktop.Shop(
businessId: _businessId,
),
desktop: desktop.Shop(
businessId: _businessId,
),
),
);
}
@override
void dispose() {
onProductWillAddToCartSubscription?.cancel();
onProductWillRemoveFromCartSubscription?.cancel();
super.dispose();
print("shop parent dispose");
}
@@ -57,137 +46,5 @@ class ShopState extends State<Shop> {
@override
void initState() {
super.initState();
onProductWillAddToCartSubscription =
eventBus.on<OnProductWillAddToCart>().listen((event) {
if (mounted) {
CartInfo cartInfo =
Utils.getCartInfoByBusiness(store.state.cartInfos, event.business);
if (cartInfo == null || cartInfo.productList.length == 0) {
cartInfo = CartInfo();
cartInfo.id = 0;
cartInfo.amountPaid = 0.0;
cartInfo.businessInfo = event.business;
cartInfo.extraFeeList = [];
cartInfo.discountList = [];
CartLineItem lineItem = Utils.newCartLineItem(
id: 0,
price: event.price,
product: event.product,
name: event.product.name,
description: event.description,
quantity: 1.0);
cartInfo.productList = [lineItem];
Utils.addSubproductToCard(cartInfo, lineItem);
store.dispatch(new UpdateCartInfo(Utils.addCartInfoToCartInfoList(
store.state.cartInfos, cartInfo)));
eventBus.fire(new OnCartInfoUpdated());
} else {
if (event.product.productAttributes.length > 0) {
CartLineItem lineItem = Utils.newCartLineItem(
id: 0,
price: event.price,
product: event.product,
name: event.product.name,
description: event.description,
quantity: 1.0);
cartInfo.productList.add(lineItem);
Utils.addSubproductToCard(cartInfo, lineItem);
store.dispatch(new UpdateCartInfo(Utils.addCartInfoToCartInfoList(
store.state.cartInfos, cartInfo)));
eventBus.fire(new OnCartInfoUpdated());
} else {
int found = -1;
for (var i = 0; i < cartInfo.productList.length; i++) {
if (event.product.id == cartInfo.productList[i].product.id) {
found = i;
break;
}
}
if (found == -1) {
CartLineItem lineItem = Utils.newCartLineItem(
id: 0,
price: event.price,
product: event.product,
name: event.product.name,
description: event.description,
quantity: 1.0);
cartInfo.productList.add(lineItem);
Utils.addSubproductToCard(cartInfo, lineItem);
store.dispatch(new UpdateCartInfo(Utils.addCartInfoToCartInfoList(
store.state.cartInfos, cartInfo)));
eventBus.fire(new OnCartInfoUpdated());
} else {
if (cartInfo.productList[found].quantity + 1.0 >
event.product.leftNum) {
Fluttertoast.showToast(
msg: S.of(context).product_insufficient,
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
backgroundColor: Colors.red,
textColor: Colors.white);
} else {
cartInfo.productList[found].quantity += 1;
Utils.addSubproductQty(cartInfo, cartInfo.productList[found]);
store.dispatch(new UpdateCartInfo(
Utils.addCartInfoToCartInfoList(
store.state.cartInfos, cartInfo)));
eventBus.fire(new OnCartInfoUpdated());
}
}
}
}
}
});
onProductWillRemoveFromCartSubscription =
eventBus.on<OnProductWillRemoveFromCart>().listen((event) {
if (mounted) {
CartInfo cartInfo =
Utils.getCartInfoByBusiness(store.state.cartInfos, event.business);
if (cartInfo != null) {
if (cartInfo.productList.length > 0) {
if (event.productListIndex != -1) {
if (cartInfo.productList[event.productListIndex].quantity <= 1) {
String uuid = cartInfo.productList[event.productListIndex].uuid;
cartInfo.productList.removeAt(event.productListIndex);
Utils.removeSubproduct(cartInfo, uuid);
} else {
cartInfo.productList[event.productListIndex].quantity -= 1;
Utils.addSubproductQty(cartInfo, cartInfo.productList[event.productListIndex], remove: true);
}
} else {
int productListIndex = -1;
for (var i = 0; i < cartInfo.productList.length; i++) {
if (cartInfo.productList[i].product.id == event.product.id) {
productListIndex = i;
break;
}
}
if (productListIndex != -1) {
if (cartInfo.productList[productListIndex].quantity <= 1) {
String uuid = cartInfo.productList[productListIndex].uuid;
cartInfo.productList.removeAt(productListIndex);
Utils.removeSubproduct(cartInfo, uuid);
} else {
cartInfo.productList[productListIndex].quantity -= 1;
Utils.addSubproductQty(cartInfo, cartInfo.productList[productListIndex], remove: true);
}
}
}
}
if (cartInfo.productList.length <= 0) {
store.dispatch(UpdateCartInfo(Utils.removeCartInfoFromCartInfoList(
store.state.cartInfos, cartInfo)));
} else {
store.dispatch(UpdateCartInfo(Utils.addCartInfoToCartInfoList(
store.state.cartInfos, cartInfo)));
}
eventBus.fire(new OnCartInfoUpdated());
}
}
});
}
}

View File

@@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_wisetronic/widgets/desktop/desktop_store_product_search.dart';
import 'package:responsive_builder/responsive_builder.dart';
import '../constants.dart';
import '../generated/l10n.dart';
import '../models/business.dart';
import '../widgets/desktop/desktop_store_product_search.dart';
import '../widgets/general/bottom_nav.dart';
import '../widgets/general/breadcrumbs.dart';
import '../widgets/general/navigationbar.dart';
@@ -22,7 +22,7 @@ class StoreProductSearch extends StatelessWidget {
return ResponsiveBuilder(
builder: (context, sizingInformation) =>
Scaffold(
appBar: NavigationBar(
appBar: MiniNavigationBar(
title: S.of(context).search_product,
back: true,
breadCrumbs: [

View File

@@ -1,66 +0,0 @@
import 'package:flutter/material.dart';
import 'package:responsive_builder/responsive_builder.dart';
import '../constants.dart';
import '../events/eventbus.dart';
import '../events/events.dart';
import '../generated/l10n.dart';
import '../widgets/desktop/desktop_tutorials.dart';
import '../widgets/general/bottom_nav.dart';
import '../widgets/general/breadcrumbs.dart';
import '../widgets/general/navigationbar.dart';
import '../widgets/mobile/MobileBottomNav.dart';
import '../widgets/mobile/mobile_navigation_drawer.dart';
import '../widgets/mobile/mobile_tutorials.dart';
class Tutorials extends StatefulWidget {
const Tutorials({Key key}) : super(key: key);
@override
State<StatefulWidget> createState() {
return TutorialsState();
}
}
class TutorialsState extends State<Tutorials> {
final _scaffoldKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
return ResponsiveBuilder(
builder: (context, sizingInformation) =>
Scaffold(
key: _scaffoldKey,
appBar: NavigationBar(
title: S.of(context).tutorials,
back: true,
breadCrumbs: [BreadCrumb(S.of(context).tutorials, null)],
breadCrumbHeight: sizingInformation.deviceScreenType == DeviceScreenType.mobile ? null : Constants.BREADCRUMB_HEIGHT,
),
drawer: null,
body: ScreenTypeLayout(
mobile: MobileTutorials(),
tablet: DesktopTutorials(),
desktop: DesktopTutorials(),
),
bottomNavigationBar: ScreenTypeLayout(
mobile: MobileBottomNav(currentIndex: 0,),
tablet: BottomNav(),
desktop: BottomNav(),
),
),
);
}
@override
void initState() {
super.initState();
eventBus.on<OpenDrawer>().listen((event) {
if (mounted) {
_scaffoldKey.currentState.openDrawer();
}
});
}
}

View File

@@ -20,7 +20,7 @@ class UserProfile extends StatelessWidget {
return ResponsiveBuilder(
builder: (context, sizingInformation) =>
Scaffold(
appBar: NavigationBar(
appBar: MiniNavigationBar(
title: S.of(context).profile,
back: true,
breadCrumbs: [

View File

@@ -42,7 +42,7 @@ class ViewBlogState extends State<ViewBlog> {
builder: (context, sizingInformation) =>
Scaffold(
key: _scaffoldKey,
appBar: NavigationBar(
appBar: MiniNavigationBar(
title: S.of(context).view_blog,
back: true,
breadCrumbs: [

View File

@@ -42,7 +42,7 @@ class ViewTicketState extends State<ViewTicket> {
builder: (context, sizingInformation) =>
Scaffold(
key: _scaffoldKey,
appBar: NavigationBar(
appBar: MiniNavigationBar(
title: S.of(context).view_ticket,
back: true,
breadCrumbs: [