-
Notifications
You must be signed in to change notification settings - Fork 136
[Woo POS] M2: Update UI based on design for success screen #12165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3763e37
7cf0eaa
b68c08d
6354e71
c0e68d3
a5c4c6f
aa18288
b50eea9
77a0e15
957e4a5
fcbcd3a
426024a
80053dd
9fd61ac
91065e7
2cacece
26ee5cc
5010eda
dfede7c
c785335
1b6f5b7
c4789e2
4578e7d
e48872b
336623b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,8 @@ | ||
| package com.woocommerce.android.ui.woopos.home.totals.payment.success | ||
|
|
||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.border | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.Spacer | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
|
|
@@ -13,18 +11,15 @@ import androidx.compose.foundation.layout.padding | |
| import androidx.compose.foundation.layout.size | ||
| import androidx.compose.foundation.layout.width | ||
| import androidx.compose.foundation.rememberScrollState | ||
| import androidx.compose.foundation.shape.RoundedCornerShape | ||
| import androidx.compose.foundation.verticalScroll | ||
| import androidx.compose.material.ButtonDefaults | ||
| import androidx.compose.material.Divider | ||
| import androidx.compose.material.Icon | ||
| import androidx.compose.material.MaterialTheme | ||
| import androidx.compose.material.OutlinedButton | ||
| import androidx.compose.material.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.graphics.Brush | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.res.painterResource | ||
| import androidx.compose.ui.res.stringResource | ||
|
|
@@ -43,33 +38,17 @@ fun WooPosPaymentSuccessScreen( | |
| onNewTransactionClicked: () -> Unit, | ||
| ) { | ||
| Column( | ||
| modifier = Modifier.fillMaxSize(), | ||
| modifier = Modifier | ||
| .fillMaxSize() | ||
| .background(Color(0xFF98F179)), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @backwardstruck I think we should not use hardcoded colors at this stage as it won't work in the dark mode
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. I'll start adding them to the xml file instead. |
||
| horizontalAlignment = Alignment.CenterHorizontally, | ||
| verticalArrangement = Arrangement.Center, | ||
| ) { | ||
| Column( | ||
| modifier = Modifier | ||
| .padding( | ||
| top = 24.dp.toAdaptivePadding(), | ||
| start = 24.dp.toAdaptivePadding(), | ||
| end = 24.dp.toAdaptivePadding(), | ||
| bottom = 0.dp | ||
| ) | ||
| .padding(24.dp.toAdaptivePadding()) | ||
| .weight(1f) | ||
| .fillMaxWidth() | ||
| .background( | ||
| color = MaterialTheme.colors.background, | ||
| shape = RoundedCornerShape(16.dp), | ||
| ) | ||
| .background( | ||
| brush = Brush.verticalGradient( | ||
| colors = listOf( | ||
| Color(152, 241, 121, 0), | ||
| Color(152, 241, 121, 0x1A) | ||
| ) | ||
| ), | ||
| shape = RoundedCornerShape(16.dp), | ||
| ) | ||
| .verticalScroll(rememberScrollState()), | ||
| horizontalAlignment = Alignment.CenterHorizontally, | ||
| verticalArrangement = Arrangement.Center, | ||
|
|
@@ -81,18 +60,22 @@ fun WooPosPaymentSuccessScreen( | |
| tint = Color.Unspecified, | ||
| contentDescription = null, | ||
| ) | ||
| Spacer(modifier = Modifier.height(32.dp.toAdaptivePadding())) | ||
| Spacer(modifier = Modifier.height(16.dp.toAdaptivePadding())) | ||
| Text( | ||
| text = stringResource(R.string.woopos_payment_successful_label), | ||
| style = MaterialTheme.typography.h4, | ||
| fontWeight = FontWeight.Bold, | ||
| textAlign = TextAlign.Center, | ||
| color = Color(0xFF004D40) | ||
| color = MaterialTheme.colors.onSurface | ||
| ) | ||
|
|
||
| Spacer(modifier = Modifier.height(32.dp.toAdaptivePadding())) | ||
|
|
||
| TotalsSummary(state) | ||
| Text( | ||
| text = stringResource(R.string.woopos_success_screen_total, state.orderTotalText), | ||
| style = MaterialTheme.typography.subtitle1, | ||
| textAlign = TextAlign.Center, | ||
| color = MaterialTheme.colors.onSurface, | ||
| modifier = Modifier.padding(24.dp.toAdaptivePadding()) | ||
| ) | ||
|
|
||
| Spacer(modifier = Modifier.weight(1f)) | ||
| } | ||
|
|
@@ -101,109 +84,26 @@ fun WooPosPaymentSuccessScreen( | |
|
|
||
| OutlinedButton( | ||
| modifier = Modifier | ||
| .padding( | ||
| top = 0.dp.toAdaptivePadding(), | ||
| start = 24.dp.toAdaptivePadding(), | ||
| end = 24.dp.toAdaptivePadding(), | ||
| bottom = 24.dp.toAdaptivePadding(), | ||
| ) | ||
| .fillMaxWidth(), | ||
| .padding(24.dp.toAdaptivePadding()) | ||
| .height(80.dp.toAdaptivePadding()) | ||
| .width(600.dp.toAdaptivePadding()), | ||
| colors = ButtonDefaults.outlinedButtonColors( | ||
| contentColor = MaterialTheme.colors.onSurface, | ||
| contentColor = MaterialTheme.colors.onSurface | ||
| ), | ||
| onClick = onNewTransactionClicked | ||
| ) { | ||
| Row( | ||
| modifier = Modifier.padding(8.dp.toAdaptivePadding()), | ||
| verticalAlignment = Alignment.CenterVertically, | ||
| ) { | ||
| Icon( | ||
| modifier = Modifier.size(24.dp), | ||
| painter = painterResource(id = R.drawable.woo_pos_ic_return_home), | ||
| contentDescription = null | ||
| ) | ||
| Spacer(modifier = Modifier.width(12.dp.toAdaptivePadding())) | ||
| Text( | ||
| text = stringResource(R.string.woopos_new_transaction_button), | ||
| style = MaterialTheme.typography.h4, | ||
| fontWeight = FontWeight.SemiBold, | ||
| textAlign = TextAlign.Center, | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Composable | ||
| private fun TotalsSummary(state: WooPosTotalsViewState.PaymentSuccess) { | ||
| Column( | ||
| modifier = Modifier | ||
| .border( | ||
| width = (0.5).dp, | ||
| color = WooPosTheme.colors.border, | ||
| shape = RoundedCornerShape(8.dp) | ||
| ) | ||
| .padding(24.dp.toAdaptivePadding()) | ||
| .width(380.dp) | ||
| ) { | ||
| Row( | ||
| modifier = Modifier.fillMaxWidth(), | ||
| horizontalArrangement = Arrangement.SpaceBetween | ||
| ) { | ||
| Text( | ||
| text = stringResource(R.string.woopos_payment_subtotal_label), | ||
| style = MaterialTheme.typography.h6, | ||
| fontWeight = FontWeight.Normal | ||
| ) | ||
| Text( | ||
| text = state.orderSubtotalText, | ||
| style = MaterialTheme.typography.h6, | ||
| fontWeight = FontWeight.Normal | ||
| ) | ||
| } | ||
|
|
||
| Spacer(modifier = Modifier.height(16.dp.toAdaptivePadding())) | ||
|
|
||
| Divider(color = WooPosTheme.colors.border, thickness = 0.5.dp) | ||
|
|
||
| Spacer(modifier = Modifier.height(16.dp.toAdaptivePadding())) | ||
|
|
||
| Row( | ||
| modifier = Modifier.fillMaxWidth(), | ||
| horizontalArrangement = Arrangement.SpaceBetween | ||
| ) { | ||
| Text( | ||
| text = stringResource(R.string.woopos_payment_tax_label), | ||
| style = MaterialTheme.typography.h6, | ||
| fontWeight = FontWeight.Normal | ||
| Icon( | ||
| modifier = Modifier.size(20.dp.toAdaptivePadding()), | ||
| painter = painterResource(id = R.drawable.woo_pos_ic_return_home), | ||
| contentDescription = null | ||
| ) | ||
| Spacer(modifier = Modifier.width(8.dp.toAdaptivePadding())) | ||
| Text( | ||
| text = state.orderTaxText, | ||
| text = stringResource(R.string.woopos_new_order_button), | ||
| style = MaterialTheme.typography.h6, | ||
| fontWeight = FontWeight.Normal | ||
| ) | ||
| } | ||
|
|
||
| Spacer(modifier = Modifier.height(16.dp.toAdaptivePadding())) | ||
|
|
||
| Divider(color = WooPosTheme.colors.border, thickness = 0.5.dp) | ||
|
|
||
| Spacer(modifier = Modifier.height(16.dp.toAdaptivePadding())) | ||
|
|
||
| Row( | ||
| modifier = Modifier.fillMaxWidth(), | ||
| horizontalArrangement = Arrangement.SpaceBetween | ||
| ) { | ||
| Text( | ||
| text = stringResource(R.string.woopos_payment_total_label), | ||
| style = MaterialTheme.typography.h6, | ||
| fontWeight = FontWeight.SemiBold | ||
| ) | ||
| Text( | ||
| text = state.orderTotalText, | ||
| style = MaterialTheme.typography.h4, | ||
| fontWeight = FontWeight.Bold, | ||
| color = Color(0xFF3C2861) | ||
| fontWeight = FontWeight.SemiBold, | ||
| color = MaterialTheme.colors.onSurface, | ||
| textAlign = TextAlign.Center | ||
| ) | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added here but as far as I can tell, we don't need it anymore. If that's not the case I will put it back. FYI @kidinov