Commit 19065023 authored by Dio Maulana's avatar Dio Maulana

gapake param get lagi

parent e04d9460
......@@ -579,6 +579,6 @@ const int typeMenu = 3;
//** type menu */
//** constanta redirect */
const String goBill = 'to-bill';
const String goBill = 'go';
//** constanta redirect */
//** END CONSTANT */
......@@ -64,22 +64,9 @@ void main() async {
configLoading();
loadAssetConfig().then((value) {
String branch = Uri.base.queryParameters["r"] ?? '';
String brand = Uri.base.queryParameters["b"] ?? '';
String table = Uri.base.queryParameters["t"] ?? '';
String idOrder = Uri.base.queryParameters["o"] ?? '';
String redirect = Uri.base.queryParameters["rd"] ?? '';
if (redirect != goBill) {
redirect = '';
}
runApp(
MyApp(
title: value,
branch: branch,
brand: brand,
table: table,
idOrder: idOrder,
tobill: redirect,
),
);
});
......@@ -125,25 +112,9 @@ Future<String> loadAssetConfig() async {
class MyApp extends StatelessWidget {
// String myUrl, branch, brand, tn, role, cashierName, toViewBill;
String title;
String branch;
String brand;
String table;
String idOrder;
String role;
String cashier;
String tobill;
String tokenParam;
MyApp({
Key? key,
required this.title,
required this.branch,
required this.brand,
required this.table,
required this.idOrder,
this.role = 'customer',
this.cashier = 'customer',
this.tobill = '',
this.tokenParam = '',
}) : super(key: key);
// This widget is the root of your application.
......@@ -172,134 +143,130 @@ class MyApp extends StatelessWidget {
String cashierNameStrg = '';
String tokenUser = '';
bool isParamGet;
if (idOrder != '' || branch != '') {
isParamGet = true;
setTableMode(openBill);
} else {
isParamGet = false;
setTableMode(closebill);
}
return MultiBlocProvider(
providers: [
BlocProvider(create: (_) => OrdersBloc()),
BlocProvider(create: (_) => BranchExist()),
// BlocProvider(create: (_) => CategoryMenu()),
BlocProvider(create: (_) => OrderVariantTemporaryBloc()),
BlocProvider(create: (_) => OrderVariantValueBloc()),
BlocProvider(create: (_) => OrderDetailVariant()),
BlocProvider(create: (_) => SearchMenu()),
BlocProvider(create: (_) => VoucherCheck()),
BlocProvider(create: (_) => CategorySelection()),
BlocProvider(create: (_) => MemberInfoBloc()),
BlocProvider(create: (_) => ViewBillBloc()),
BlocProvider(create: (_) => FeedBackOptionBloc()),
BlocProvider(create: (_) => FeedbackSelect()),
BlocProvider(create: (_) => FilterMenuBloc()),
BlocProvider(create: (_) => VoucherListBloc()),
BlocProvider(create: (_) => FavSelectedBar()),
BlocProvider(create: (_) => MenuSelectedBar()),
BlocProvider(create: (_) => SearchActive()),
BlocProvider(create: (_) => SearchHistory()),
],
child: (!isParamGet)
? MaterialApp(
title: (title == null) ? defaultTitle : title,
builder: EasyLoading.init(),
debugShowCheckedModeBanner: false,
onGenerateRoute: (routes) {
var uri = Uri.parse(routes.name!);
if (uri.pathSegments.isEmpty) {
return MaterialPageRoute(
builder: (context) => NoRoute(
identification: 'emptyUri',
),
);
} else if (uri.pathSegments.length == 3) {
brandStrg = uri.pathSegments.first;
branchStrg = uri.pathSegments[1];
tnStrg = uri.pathSegments[2];
providers: [
BlocProvider(create: (_) => OrdersBloc()),
BlocProvider(create: (_) => BranchExist()),
// BlocProvider(create: (_) => CategoryMenu()),
BlocProvider(create: (_) => OrderVariantTemporaryBloc()),
BlocProvider(create: (_) => OrderVariantValueBloc()),
BlocProvider(create: (_) => OrderDetailVariant()),
BlocProvider(create: (_) => SearchMenu()),
BlocProvider(create: (_) => VoucherCheck()),
BlocProvider(create: (_) => CategorySelection()),
BlocProvider(create: (_) => MemberInfoBloc()),
BlocProvider(create: (_) => ViewBillBloc()),
BlocProvider(create: (_) => FeedBackOptionBloc()),
BlocProvider(create: (_) => FeedbackSelect()),
BlocProvider(create: (_) => FilterMenuBloc()),
BlocProvider(create: (_) => VoucherListBloc()),
BlocProvider(create: (_) => FavSelectedBar()),
BlocProvider(create: (_) => MenuSelectedBar()),
BlocProvider(create: (_) => SearchActive()),
BlocProvider(create: (_) => SearchHistory()),
],
child: MaterialApp(
title: (title == null) ? defaultTitle : title,
builder: EasyLoading.init(),
debugShowCheckedModeBanner: false,
onGenerateRoute: (routes) {
var uri = Uri.parse(routes.name!);
if (uri.pathSegments.isEmpty) {
setTableMode(closebill);
return MaterialPageRoute(
builder: (context) => NoRoute(
identification: 'emptyUri',
),
);
} else if (uri.pathSegments.length == 2) {
String firstPath = uri.pathSegments.first;
if (firstPath == 'o') {
setTableMode(openBill);
// String orderId = uri.pathSegments[1];
// do some api request for orderId
}
return MaterialPageRoute(
builder: (_) => Splash(
branch: branchStrg,
brand: brandStrg,
tn: tnStrg,
role: roleStrg,
cashierName: cashierNameStrg,
toBill: toBill,
orderId: orderId,
token: tokenUser,
),
);
} else if (uri.pathSegments.length == 4) {
brandStrg = uri.pathSegments.first;
branchStrg = uri.pathSegments[1];
tnStrg = uri.pathSegments[2];
if (uri.pathSegments[3] == goBill) {
toBill = goBill;
} else if (uri.pathSegments[3].length == 32) {
// its uuid or not
return MaterialPageRoute(
builder: (_) => Splash(
branch: branchStrg,
brand: brandStrg,
tn: tnStrg,
role: roleStrg,
cashierName: cashierNameStrg,
toBill: toBill,
orderId: orderId,
token: tokenUser,
),
);
} else if (uri.pathSegments.length == 3) {
brandStrg = uri.pathSegments.first;
branchStrg = uri.pathSegments[1];
tnStrg = uri.pathSegments[2];
tokenUser = uri.pathSegments[3];
isExcelso = true;
}
return MaterialPageRoute(
builder: (_) => Splash(
branch: branchStrg,
brand: brandStrg,
tn: tnStrg,
role: roleStrg,
cashierName: cashierNameStrg,
toBill: toBill,
orderId: orderId,
token: tokenUser,
),
);
} else if (uri.pathSegments.length == 5) {
brandStrg = uri.pathSegments.first;
branchStrg = uri.pathSegments[1];
tnStrg = uri.pathSegments[2];
if (uri.pathSegments[3] == 'cashier') {
// roleStrg = 'cashier';
roleStrg = 'customer';
cashierNameStrg = uri.pathSegments[4];
} else if (uri.pathSegments[3].length == 32 &&
uri.pathSegments[4] == goBill) {
tokenUser = uri.pathSegments[3];
isExcelso = true;
toBill = goBill;
}
return MaterialPageRoute(
builder: (_) => Splash(
branch: branchStrg,
brand: brandStrg,
tn: tnStrg,
role: roleStrg,
cashierName: cashierNameStrg,
toBill: toBill,
orderId: orderId,
token: tokenUser,
),
);
return MaterialPageRoute(
builder: (_) => Splash(
branch: branchStrg,
brand: brandStrg,
tn: tnStrg,
role: roleStrg,
cashierName: cashierNameStrg,
toBill: toBill,
orderId: orderId,
token: tokenUser,
),
);
} else if (uri.pathSegments.length == 4) {
brandStrg = uri.pathSegments.first;
branchStrg = uri.pathSegments[1];
tnStrg = uri.pathSegments[2];
if (uri.pathSegments[3] == goBill) {
toBill = goBill;
} else if (uri.pathSegments[3].length == 32) {
// its uuid or not
tokenUser = uri.pathSegments[3];
isExcelso = true;
}
return null;
})
: MaterialApp(
title: (title == null) ? defaultTitle : title,
builder: EasyLoading.init(),
debugShowCheckedModeBanner: false,
home: Splash(
branch: branch,
brand: brand,
tn: table,
role: role,
cashierName: cashier,
toBill: tobill,
orderId: orderId,
token: tokenParam,
),
),
);
return MaterialPageRoute(
builder: (_) => Splash(
branch: branchStrg,
brand: brandStrg,
tn: tnStrg,
role: roleStrg,
cashierName: cashierNameStrg,
toBill: toBill,
orderId: orderId,
token: tokenUser,
),
);
} else if (uri.pathSegments.length == 5) {
brandStrg = uri.pathSegments.first;
branchStrg = uri.pathSegments[1];
tnStrg = uri.pathSegments[2];
if (uri.pathSegments[3] == 'cashier') {
// roleStrg = 'cashier';
roleStrg = 'customer';
cashierNameStrg = uri.pathSegments[4];
} else if (uri.pathSegments[3].length == 32 &&
uri.pathSegments[4] == goBill) {
tokenUser = uri.pathSegments[3];
isExcelso = true;
toBill = goBill;
}
return MaterialPageRoute(
builder: (_) => Splash(
branch: branchStrg,
brand: brandStrg,
tn: tnStrg,
role: roleStrg,
cashierName: cashierNameStrg,
toBill: toBill,
orderId: orderId,
token: tokenUser,
),
);
}
return null;
}));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment