WT 1.1.18+9 sales page products
This commit is contained in:
parent
e38a26dbc9
commit
e5f5f305dd
@ -30,7 +30,7 @@ class SalesBloc extends Bloc<SalesEvent, SalesState> with Logging {
|
|||||||
String? salesText;
|
String? salesText;
|
||||||
String? premiumFunctions = "";
|
String? premiumFunctions = "";
|
||||||
|
|
||||||
void init() async {
|
Future<void> init() async {
|
||||||
if (Cache().userLoggedIn == null) {
|
if (Cache().userLoggedIn == null) {
|
||||||
throw Exception("Please log in");
|
throw Exception("Please log in");
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ class SalesBloc extends Bloc<SalesEvent, SalesState> with Logging {
|
|||||||
if (event is SalesLoad) {
|
if (event is SalesLoad) {
|
||||||
log(" -- start SalesLoad");
|
log(" -- start SalesLoad");
|
||||||
yield SalesLoading();
|
yield SalesLoading();
|
||||||
init();
|
await init();
|
||||||
yield SalesReady();
|
yield SalesReady();
|
||||||
log(" -- finish SalesLoad");
|
log(" -- finish SalesLoad");
|
||||||
} else if (event is SalesPurchase) {
|
} else if (event is SalesPurchase) {
|
||||||
|
@ -34,8 +34,12 @@ class UserRepository with Logging {
|
|||||||
await CustomerApi().addUser(modelUser);
|
await CustomerApi().addUser(modelUser);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(e.toString());
|
final String message = e.toString();
|
||||||
throw new Exception(e);
|
log(message);
|
||||||
|
if (message.contains("CERT_ALREADY_IN_HASH_TABLE")) {
|
||||||
|
} else {
|
||||||
|
throw new Exception(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ class APIClient with Common, Logging {
|
|||||||
final body = '{"username":"$email", "password":"$password"}';
|
final body = '{"username":"$email", "password":"$password"}';
|
||||||
request.write(body);
|
request.write(body);
|
||||||
HttpClientResponse result = await request.close();
|
HttpClientResponse result = await request.close();
|
||||||
|
client.close();
|
||||||
if (result.statusCode != 200) {
|
if (result.statusCode != 200) {
|
||||||
trace("authentication response: ${result.statusCode}");
|
trace("authentication response: ${result.statusCode}");
|
||||||
throw Exception("Network error, try again later!");
|
throw Exception("Network error, try again later!");
|
||||||
@ -58,6 +59,7 @@ class APIClient with Common, Logging {
|
|||||||
//request.contentLength = body.length;
|
//request.contentLength = body.length;
|
||||||
request.write(body);
|
request.write(body);
|
||||||
HttpClientResponse result = await request.close();
|
HttpClientResponse result = await request.close();
|
||||||
|
client.close();
|
||||||
trace(" ------------post response code: " + result.statusCode.toString());
|
trace(" ------------post response code: " + result.statusCode.toString());
|
||||||
if (result.statusCode == 200) {
|
if (result.statusCode == 200) {
|
||||||
return await result.transform(utf8.decoder).join();
|
return await result.transform(utf8.decoder).join();
|
||||||
@ -90,6 +92,7 @@ class APIClient with Common, Logging {
|
|||||||
request.headers.set('Content-Type', 'application/json');
|
request.headers.set('Content-Type', 'application/json');
|
||||||
request.headers.set('Authorization', 'Bearer $authToken');
|
request.headers.set('Authorization', 'Bearer $authToken');
|
||||||
HttpClientResponse result = await request.close();
|
HttpClientResponse result = await request.close();
|
||||||
|
client.close();
|
||||||
trace(" ------------get response code: " + result.statusCode.toString());
|
trace(" ------------get response code: " + result.statusCode.toString());
|
||||||
if (result.statusCode == 200) {
|
if (result.statusCode == 200) {
|
||||||
return await result.transform(utf8.decoder).join();
|
return await result.transform(utf8.decoder).join();
|
||||||
|
@ -173,7 +173,7 @@ class SalesPage extends StatelessWidget with Trans, Logging {
|
|||||||
darkShadow: true,
|
darkShadow: true,
|
||||||
blurRadius: 12,
|
blurRadius: 12,
|
||||||
animationCurve: Curves.easeIn,
|
animationCurve: Curves.easeIn,
|
||||||
height: 150,
|
height: 180,
|
||||||
width: 160,
|
width: 160,
|
||||||
onTap: () => bloc.add(SalesPurchase(productId: bloc.product2Display[idx].productId)),
|
onTap: () => bloc.add(SalesPurchase(productId: bloc.product2Display[idx].productId)),
|
||||||
isMultiColor: true,
|
isMultiColor: true,
|
||||||
@ -217,13 +217,6 @@ class SalesPage extends StatelessWidget with Trans, Logging {
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: FontSize(16),
|
fontSize: FontSize(16),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
/* textShadow: <Shadow>[
|
|
||||||
Shadow(
|
|
||||||
offset: Offset(3.0, 3.0),
|
|
||||||
blurRadius: 4.0,
|
|
||||||
color: Colors.black54,
|
|
||||||
),
|
|
||||||
], */
|
|
||||||
),
|
),
|
||||||
"h1": Style(
|
"h1": Style(
|
||||||
color: Colors.blue[400],
|
color: Colors.blue[400],
|
||||||
@ -342,35 +335,4 @@ class SalesPage extends StatelessWidget with Trans, Logging {
|
|||||||
},
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> getButtons(SalesBloc bloc) {
|
|
||||||
List<Widget> buttons = [];
|
|
||||||
|
|
||||||
bloc.product2Display.forEach((element) {
|
|
||||||
final String title = element.sort == 3 ? t("Montly") : t("Annual");
|
|
||||||
final String desc4 = element.sort == 1 ? "" : t("Predictions with Artificial Intelligence");
|
|
||||||
String? badge;
|
|
||||||
if (element.sort == 2) {
|
|
||||||
badge = t("14% discount");
|
|
||||||
} else if (element.sort == 1) {
|
|
||||||
badge = t("2 months free");
|
|
||||||
}
|
|
||||||
Widget button = SalesButton(
|
|
||||||
title: title,
|
|
||||||
price: element.localizedPrice!,
|
|
||||||
desc1: t("Development programs"),
|
|
||||||
desc2: t("Suggestions based on your actual status"),
|
|
||||||
desc3: t("Special customized training plans"),
|
|
||||||
desc4: desc4,
|
|
||||||
descStyle: GoogleFonts.inter(fontSize: 10, color: Colors.blue[800]),
|
|
||||||
badgeText: badge,
|
|
||||||
badgeColor: element.sort == 3 ? Colors.transparent : Colors.orange,
|
|
||||||
style: GoogleFonts.archivoBlack(fontSize: 14, color: Colors.blue[800]),
|
|
||||||
onTap: () => {bloc.add(SalesPurchase(productId: element.productId))},
|
|
||||||
);
|
|
||||||
buttons.add(button);
|
|
||||||
});
|
|
||||||
|
|
||||||
return buttons;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 1.1.18+87
|
version: 1.1.18+88
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.12.0 <3.0.0"
|
sdk: ">=2.12.0 <3.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user