WT 1.1.18+9 sales page products

This commit is contained in:
bossanyit 2021-06-08 17:02:39 +02:00
parent e38a26dbc9
commit e5f5f305dd
5 changed files with 13 additions and 44 deletions

View File

@ -30,7 +30,7 @@ class SalesBloc extends Bloc<SalesEvent, SalesState> with Logging {
String? salesText;
String? premiumFunctions = "";
void init() async {
Future<void> init() async {
if (Cache().userLoggedIn == null) {
throw Exception("Please log in");
}
@ -60,7 +60,7 @@ class SalesBloc extends Bloc<SalesEvent, SalesState> with Logging {
if (event is SalesLoad) {
log(" -- start SalesLoad");
yield SalesLoading();
init();
await init();
yield SalesReady();
log(" -- finish SalesLoad");
} else if (event is SalesPurchase) {

View File

@ -34,8 +34,12 @@ class UserRepository with Logging {
await CustomerApi().addUser(modelUser);
}
} catch (e) {
log(e.toString());
throw new Exception(e);
final String message = e.toString();
log(message);
if (message.contains("CERT_ALREADY_IN_HASH_TABLE")) {
} else {
throw new Exception(e);
}
}
}

View File

@ -28,6 +28,7 @@ class APIClient with Common, Logging {
final body = '{"username":"$email", "password":"$password"}';
request.write(body);
HttpClientResponse result = await request.close();
client.close();
if (result.statusCode != 200) {
trace("authentication response: ${result.statusCode}");
throw Exception("Network error, try again later!");
@ -58,6 +59,7 @@ class APIClient with Common, Logging {
//request.contentLength = body.length;
request.write(body);
HttpClientResponse result = await request.close();
client.close();
trace(" ------------post response code: " + result.statusCode.toString());
if (result.statusCode == 200) {
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('Authorization', 'Bearer $authToken');
HttpClientResponse result = await request.close();
client.close();
trace(" ------------get response code: " + result.statusCode.toString());
if (result.statusCode == 200) {
return await result.transform(utf8.decoder).join();

View File

@ -173,7 +173,7 @@ class SalesPage extends StatelessWidget with Trans, Logging {
darkShadow: true,
blurRadius: 12,
animationCurve: Curves.easeIn,
height: 150,
height: 180,
width: 160,
onTap: () => bloc.add(SalesPurchase(productId: bloc.product2Display[idx].productId)),
isMultiColor: true,
@ -217,13 +217,6 @@ class SalesPage extends StatelessWidget with Trans, Logging {
fontWeight: FontWeight.bold,
fontSize: FontSize(16),
textAlign: TextAlign.center,
/* textShadow: <Shadow>[
Shadow(
offset: Offset(3.0, 3.0),
blurRadius: 4.0,
color: Colors.black54,
),
], */
),
"h1": Style(
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;
}
}

View File

@ -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.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.1.18+87
version: 1.1.18+88
environment:
sdk: ">=2.12.0 <3.0.0"