Skip to content

Commit 0e7898a

Browse files
committed
fix(shopinbit): lock shipping country, fix billing overflow, remove T&C from payment, add done button
1 parent 08a04c5 commit 0e7898a

2 files changed

Lines changed: 23 additions & 70 deletions

File tree

lib/pages/shopinbit/shopinbit_payment_view.dart

Lines changed: 14 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ import 'dart:async';
22
import 'dart:io';
33

44
import 'package:decimal/decimal.dart';
5-
import 'package:flutter/gestures.dart';
65
import 'package:flutter/material.dart';
76
import 'package:flutter/services.dart';
87
import 'package:flutter_riverpod/flutter_riverpod.dart';
98
import 'package:flutter_svg/svg.dart';
10-
import 'package:url_launcher/url_launcher.dart';
119

1210
import '../../app_config.dart';
1311
import '../../models/isar/models/ethereum/eth_contract.dart';
@@ -48,7 +46,6 @@ class ShopInBitPaymentView extends ConsumerStatefulWidget {
4846
}
4947

5048
class _ShopInBitPaymentViewState extends ConsumerState<ShopInBitPaymentView> {
51-
bool _termsAccepted = false;
5249
bool _loading = false;
5350
int _selectedMethod = 0;
5451
Timer? _pollTimer;
@@ -76,8 +73,7 @@ class _ShopInBitPaymentViewState extends ConsumerState<ShopInBitPaymentView> {
7673
'payment_processing',
7774
}.contains(_status);
7875

79-
bool get _payNowEnabled =>
80-
_termsAccepted && !_isExpiredOrInvalid && !_isTerminal;
76+
bool get _payNowEnabled => !_isExpiredOrInvalid && !_isTerminal;
8177

8278
@override
8379
void initState() {
@@ -160,11 +156,6 @@ class _ShopInBitPaymentViewState extends ConsumerState<ShopInBitPaymentView> {
160156
}
161157
}
162158

163-
Future<void> _openTerms() async {
164-
const url = "https://api.shopinbit.com/static/policy/terms.html";
165-
await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);
166-
}
167-
168159
Future<void> _checkForPayment() async {
169160
_pollTimer?.cancel();
170161
setState(() => _loading = true);
@@ -334,6 +325,14 @@ class _ShopInBitPaymentViewState extends ConsumerState<ShopInBitPaymentView> {
334325
Navigator.of(context).pop();
335326
}
336327

328+
void _navigateToTickets() {
329+
if (Util.isDesktop) {
330+
Navigator.of(context, rootNavigator: true).pop();
331+
} else {
332+
Navigator.of(context).popUntil((route) => route.isFirst);
333+
}
334+
}
335+
337336
void _navigateToSendFrom({
338337
required CryptoCurrency coin,
339338
required Amount? amount,
@@ -709,59 +708,15 @@ class _ShopInBitPaymentViewState extends ConsumerState<ShopInBitPaymentView> {
709708
],
710709
),
711710
),
711+
SizedBox(height: isDesktop ? 16 : 12),
712+
PrimaryButton(
713+
label: "View My Requests",
714+
onPressed: _navigateToTickets,
715+
),
712716
],
713717
SizedBox(height: isDesktop ? 24 : 16),
714718
// Coin list (replaces tab selector + QR + address + global button)
715719
if (!_isExpiredOrInvalid) ...coinRows,
716-
SizedBox(height: isDesktop ? 16 : 12),
717-
GestureDetector(
718-
onTap: () {
719-
setState(() {
720-
_termsAccepted = !_termsAccepted;
721-
});
722-
},
723-
child: Container(
724-
color: Colors.transparent,
725-
child: Row(
726-
crossAxisAlignment: CrossAxisAlignment.start,
727-
children: [
728-
SizedBox(
729-
width: 20,
730-
height: 20,
731-
child: IgnorePointer(
732-
child: Checkbox(
733-
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
734-
value: _termsAccepted,
735-
onChanged: (_) {},
736-
),
737-
),
738-
),
739-
const SizedBox(width: 12),
740-
Expanded(
741-
child: RichText(
742-
text: TextSpan(
743-
style: isDesktop
744-
? STextStyles.desktopTextExtraExtraSmall(context)
745-
: STextStyles.w500_14(context),
746-
children: [
747-
const TextSpan(text: "I accept the "),
748-
TextSpan(
749-
text: "Terms & Conditions",
750-
style: STextStyles.richLink(
751-
context,
752-
).copyWith(fontSize: isDesktop ? null : 14),
753-
recognizer: TapGestureRecognizer()
754-
..onTap = _openTerms,
755-
),
756-
const TextSpan(text: "."),
757-
],
758-
),
759-
),
760-
),
761-
],
762-
),
763-
),
764-
),
765720
],
766721
);
767722

lib/pages/shopinbit/shopinbit_shipping_view.dart

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ class _ShopInBitShippingViewState extends State<ShopInBitShippingView> {
105105
_billingCityFocusNode = FocusNode();
106106
_billingPostalCodeFocusNode = FocusNode();
107107

108+
_selectedCountryIso = widget.model.deliveryCountry.isNotEmpty
109+
? widget.model.deliveryCountry
110+
: null;
111+
108112
for (final node in [
109113
_nameFocusNode,
110114
_streetFocusNode,
@@ -372,15 +376,9 @@ class _ShopInBitShippingViewState extends State<ShopInBitShippingView> {
372376
_countrySearchController.clear();
373377
}
374378
},
375-
onChanged: _loadingCountries
376-
? null
377-
: (value) {
378-
setState(() {
379-
_selectedCountryIso = value;
380-
});
381-
},
379+
onChanged: null,
382380
hint: Text(
383-
_loadingCountries ? "Loading countries..." : "Country",
381+
"Country",
384382
style: isDesktop
385383
? STextStyles.desktopTextExtraSmall(context).copyWith(
386384
color: Theme.of(context)
@@ -677,7 +675,7 @@ class _ShopInBitShippingViewState extends State<ShopInBitShippingView> {
677675
),
678676
),
679677
],
680-
const Spacer(),
678+
const SizedBox(height: 24),
681679
PrimaryButton(
682680
label: _submitting ? "Submitting..." : "Continue to payment",
683681
enabled: _canContinue,
@@ -689,7 +687,7 @@ class _ShopInBitShippingViewState extends State<ShopInBitShippingView> {
689687
if (isDesktop) {
690688
return DesktopDialog(
691689
maxWidth: 580,
692-
maxHeight: 600,
690+
maxHeight: 700,
693691
child: Column(
694692
children: [
695693
Row(
@@ -711,7 +709,7 @@ class _ShopInBitShippingViewState extends State<ShopInBitShippingView> {
711709
horizontal: 32,
712710
vertical: 16,
713711
),
714-
child: content,
712+
child: SingleChildScrollView(child: content),
715713
),
716714
),
717715
],

0 commit comments

Comments
 (0)