feat(shopinbit): category-specific form fields in step 4
What changed, and why it matters
This commit is a routine feature update for the ShopinBit shopping integration inside Stack Wallet. It adds category-specific form fields (concierge and car-research requests), separates delivery and billing addresses, and updates the displayed research fee from €50 to €223. There is no clear security bug in the diff itself, but the large UI refactor introduces more places where user input is collected and sent to the ShopinBit backend, so input handling and backend trust should be watched.
Treat as a normal feature commit. Review the backend API (createCarResearchInvoice, setShippingAddress, and the generic request submission) to ensure server-side validation and output encoding are applied for the new free-text and address fields. Verify the €223 fee matches the intended business rule. No immediate patch or incident response is indicated by this diff alone.
Security signals we found
Large UI refactor (+1243/-270) in a payment/order flow
New user input surfaces: free-text description fields, brand/model, budget, billing address
Client-side numeric validation added (min/max budgets)
Optional separate billing address now collected and passed to backend invoice creation
Hardcoded research fee changed from 50.00 EUR to 223.00 EUR
No visible output encoding/sanitization of free-text fields before backend submission
Evidence from the diff
The patch refactors two Dart files that implement the ShopinBit checkout flow. It splits a single description/country form into concierge, car-research, and travel variants, adds controllers/formatters for numeric budgets, and reworks the car-fee view to capture a delivery address plus an optional separate billing address. The code then calls ShopInBitService.client.createCarResearchInvoice(billing: billing) and setShippingAddress(…). All user strings are trimmed before use and numeric fields use FilteringTextInputFormatter.digitsOnly with client-side range checks. No obvious injection, memory-leak, or logic flaw is visible in the diff, though the change is large and partial context is unavailable.
Changed components
lib/pages/shopinbit/shopinbit_step_4.dartlib/pages/shopinbit/shopinbit_car_fee_view.dartShopInBitService client integrationCar research invoice creation flowInspect captured patch +1243 / −270
diff --git a/lib/pages/shopinbit/shopinbit_car_fee_view.dart b/lib/pages/shopinbit/shopinbit_car_fee_view.dart
index 56f490a..9b34a91 100644
--- a/lib/pages/shopinbit/shopinbit_car_fee_view.dart
+++ b/lib/pages/shopinbit/shopinbit_car_fee_view.dart
@@ -48,20 +48,47 @@ class _ShopInBitCarFeeViewState extends State<ShopInBitCarFeeView> {
late final FocusNode _postalCodeFocusNode;
List<Map<String, dynamic>> _countries = [];
+ String? _selectedCountryIso;
+ bool _loadingCountries = false;
+ final TextEditingController _countrySearchController =
+ TextEditingController();
+
+ // Billing address (optional, separate from delivery)
+ bool _differentBilling = false;
+ late final TextEditingController _billingNameController;
+ late final TextEditingController _billingStreetController;
+ late final TextEditingController _billingCityController;
+ late final TextEditingController _billingPostalCodeController;
+ late final FocusNode _billingNameFocusNode;
+ late final FocusNode _billingStreetFocusNode;
+ late final FocusNode _billingCityFocusNode;
+ late final FocusNode _billingPostalCodeFocusNode;
String? _selectedBillingCountryIso;
- bool _loadingBillingCountries = false;
final TextEditingController _billingCountrySearchController =
TextEditingController();
- String _displayedFee = "50.00 EUR";
+ String _displayedFee = "223.00 EUR";
bool _submitting = false;
- bool get _canContinue =>
- _nameController.text.trim().isNotEmpty &&
- _streetController.text.trim().isNotEmpty &&
- _cityController.text.trim().isNotEmpty &&
- _postalCodeController.text.trim().isNotEmpty &&
- _selectedBillingCountryIso != null;
+ bool get _canContinue {
+ if (_nameController.text.trim().isEmpty ||
+ _streetController.text.trim().isEmpty ||
+ _cityController.text.trim().isEmpty ||
+ _postalCodeController.text.trim().isEmpty ||
+ _selectedCountryIso == null) {
+ return false;
+ }
+ if (_differentBilling) {
+ if (_billingNameController.text.trim().isEmpty ||
+ _billingStreetController.text.trim().isEmpty ||
+ _billingCityController.text.trim().isEmpty ||
+ _billingPostalCodeController.text.trim().isEmpty ||
+ _selectedBillingCountryIso == null) {
+ return false;
+ }
+ }
+ return true;
+ }
@override
void initState() {
@@ -74,12 +101,24 @@ class _ShopInBitCarFeeViewState extends State<ShopInBitCarFeeView> {
_streetFocusNode = FocusNode();
_cityFocusNode = FocusNode();
_postalCodeFocusNode = FocusNode();
+ _billingNameController = TextEditingController();
+ _billingStreetController = TextEditingController();
+ _billingCityController = TextEditingController();
+ _billingPostalCodeController = TextEditingController();
+ _billingNameFocusNode = FocusNode();
+ _billingStreetFocusNode = FocusNode();
+ _billingCityFocusNode = FocusNode();
+ _billingPostalCodeFocusNode = FocusNode();
for (final node in [
_nameFocusNode,
_streetFocusNode,
_cityFocusNode,
_postalCodeFocusNode,
+ _billingNameFocusNode,
+ _billingStreetFocusNode,
+ _billingCityFocusNode,
+ _billingPostalCodeFocusNode,
]) {
node.addListener(() => setState(() {}));
}
@@ -97,7 +136,16 @@ class _ShopInBitCarFeeViewState extends State<ShopInBitCarFeeView> {
_streetFocusNode.dispose();
_cityFocusNode.dispose();
_postalCodeFocusNode.dispose();
+ _billingNameController.dispose();
+ _billingStreetController.dispose();
+ _billingCityController.dispose();
+ _billingPostalCodeController.dispose();
+ _billingNameFocusNode.dispose();
+ _billingStreetFocusNode.dispose();
+ _billingCityFocusNode.dispose();
+ _billingPostalCodeFocusNode.dispose();
_billingCountrySearchController.dispose();
+ _countrySearchController.dispose();
super.dispose();
}
@@ -118,22 +166,22 @@ class _ShopInBitCarFeeViewState extends State<ShopInBitCarFeeView> {
}
Future<void> _fetchCountries() async {
- setState(() => _loadingBillingCountries = true);
+ setState(() => _loadingCountries = true);
try {
final resp =
await ShopInBitService.instance.client.getCountries();
if (resp.hasError || resp.value == null) return;
_countries = resp.value!;
- if (_selectedBillingCountryIso != null &&
+ if (_selectedCountryIso != null &&
!_countries.any(
- (c) => c['iso'] == _selectedBillingCountryIso,
+ (c) => c['iso'] == _selectedCountryIso,
)) {
- _selectedBillingCountryIso = null;
+ _selectedCountryIso = null;
}
} catch (_) {
// leave list empty; user will see no items
} finally {
- if (mounted) setState(() => _loadingBillingCountries = false);
+ if (mounted) setState(() => _loadingCountries = false);
}
}
@@ -155,16 +203,39 @@ class _ShopInBitCarFeeViewState extends State<ShopInBitCarFeeView> {
try {
await ShopInBitService.instance.ensureCustomerKey();
- final name = _splitFullName(_nameController.text);
- final billing = Address(
- firstName: name.first,
- lastName: name.last,
+ // Delivery address (always provided)
+ final deliveryName = _splitFullName(_nameController.text);
+ widget.model.setShippingAddress(
+ name: _nameController.text.trim(),
street: _streetController.text.trim(),
- zip: _postalCodeController.text.trim(),
city: _cityController.text.trim(),
- country: _selectedBillingCountryIso!,
+ postalCode: _postalCodeController.text.trim(),
+ country: _selectedCountryIso!,
);
+ // Billing address: use separate billing fields if different, else use delivery
+ final Address billing;
+ if (_differentBilling) {
+ final billingName = _splitFullName(_billingNameController.text);
+ billing = Address(
+ firstName: billingName.first,
+ lastName: billingName.last,
+ street: _billingStreetController.text.trim(),
+ zip: _billingPostalCodeController.text.trim(),
+ city: _billingCityController.text.trim(),
+ country: _selectedBillingCountryIso!,
+ );
+ } else {
+ billing = Address(
+ firstName: deliveryName.first,
+ lastName: deliveryName.last,
+ street: _streetController.text.trim(),
+ zip: _postalCodeController.text.trim(),
+ city: _cityController.text.trim(),
+ country: _selectedCountryIso!,
+ );
+ }
+
final resp = await ShopInBitService.instance.client
.createCarResearchInvoice(billing: billing);
@@ -276,7 +347,7 @@ class _ShopInBitCarFeeViewState extends State<ShopInBitCarFeeView> {
} catch (_) {
// Leave placeholder in place.
}
- // No parse succeeded — leave the existing "50.00 EUR" business-rule
+ // No parse succeeded — leave the existing "223.00 EUR" business-rule
// placeholder in place rather than showing "—".
}
@@ -319,6 +390,127 @@ class _ShopInBitCarFeeViewState extends State<ShopInBitCarFeeView> {
);
}
+ Widget _buildCountryDropdown({
+ required String? value,
+ required ValueChanged<String?> onChanged,
+ required String hint,
+ required TextEditingController searchController,
+ required bool isDesktop,
+ }) {
+ return ClipRRect(
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius,
+ ),
+ child: DropdownButtonHideUnderline(
+ child: DropdownButton2<String>(
+ value: value,
+ items: _countries
+ .map(
+ (c) => DropdownMenuItem<String>(
+ value: c['iso'] as String,
+ child: Text(
+ c['label'] as String,
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(
+ context,
+ ).copyWith(
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .textFieldActiveText,
+ )
+ : STextStyles.w500_14(context),
+ ),
+ ),
+ )
+ .toList(),
+ onMenuStateChange: (isOpen) {
+ if (!isOpen) {
+ searchController.clear();
+ }
+ },
+ onChanged: _loadingCountries ? null : onChanged,
+ hint: Text(
+ _loadingCountries ? "Loading countries..." : hint,
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(context).copyWith(
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .textFieldDefaultSearchIconLeft,
+ )
+ : STextStyles.fieldLabel(context),
+ ),
+ isExpanded: true,
+ buttonStyleData: ButtonStyleData(
+ decoration: BoxDecoration(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius,
+ ),
+ ),
+ ),
+ iconStyleData: IconStyleData(
+ icon: Padding(
+ padding: const EdgeInsets.only(right: 10),
+ child: SvgPicture.asset(
+ Assets.svg.chevronDown,
+ width: 12,
+ height: 6,
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .textFieldActiveSearchIconRight,
+ ),
+ ),
+ ),
+ dropdownStyleData: DropdownStyleData(
+ offset: const Offset(0, 0),
+ elevation: 0,
+ maxHeight: 300,
+ decoration: BoxDecoration(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius,
+ ),
+ ),
+ ),
+ dropdownSearchData: DropdownSearchData<String>(
+ searchController: searchController,
+ searchInnerWidgetHeight: 48,
+ searchInnerWidget: TextFormField(
+ controller: searchController,
+ decoration: InputDecoration(
+ isDense: true,
+ contentPadding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ vertical: 14,
+ ),
+ hintText: "Search...",
+ hintStyle: STextStyles.fieldLabel(context),
+ border: InputBorder.none,
+ ),
+ ),
+ searchMatchFn: (item, searchValue) {
+ final label = _countries
+ .where((c) => c['iso'] == item.value)
+ .map((c) => c['label'] as String)
+ .firstOrNull;
+ return label?.toLowerCase().contains(
+ searchValue.toLowerCase(),
+ ) ??
+ false;
+ },
+ ),
+ menuItemStyleData: const MenuItemStyleData(
+ padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
+ ),
+ ),
+ ),
+ );
+ }
+
@override
Widget build(BuildContext context) {
final isDesktop = Util.isDesktop;
@@ -355,7 +547,7 @@ class _ShopInBitCarFeeViewState extends State<ShopInBitCarFeeView> {
),
SizedBox(height: isDesktop ? 24 : 16),
Text(
- "Billing address",
+ "Delivery address",
style: isDesktop
? STextStyles.desktopTextSmall(context)
: STextStyles.titleBold12(context),
@@ -397,126 +589,106 @@ class _ShopInBitCarFeeViewState extends State<ShopInBitCarFeeView> {
],
),
spacing,
- ClipRRect(
- borderRadius: BorderRadius.circular(
- Constants.size.circularBorderRadius,
- ),
- child: DropdownButtonHideUnderline(
- child: DropdownButton2<String>(
- value: _selectedBillingCountryIso,
- items: _countries
- .map(
- (c) => DropdownMenuItem<String>(
- value: c['iso'] as String,
- child: Text(
- c['label'] as String,
- style: isDesktop
- ? STextStyles.desktopTextExtraSmall(
- context,
- ).copyWith(
- color: Theme.of(context)
- .extension<StackColors>()!
- .textFieldActiveText,
- )
- : STextStyles.w500_14(context),
- ),
+ _buildCountryDropdown(
+ value: _selectedCountryIso,
+ onChanged: (v) => setState(() => _selectedCountryIso = v),
+ hint: "Country",
+ searchController: _countrySearchController,
+ isDesktop: isDesktop,
+ ),
+ spacing,
+ GestureDetector(
+ onTap: () {
+ setState(() {
+ _differentBilling = !_differentBilling;
+ if (!_differentBilling) {
+ _billingNameController.clear();
+ _billingStreetController.clear();
+ _billingCityController.clear();
+ _billingPostalCodeController.clear();
+ _selectedBillingCountryIso = null;
+ }
+ });
+ },
+ child: Container(
+ color: Colors.transparent,
+ child: Row(
+ children: [
+ SizedBox(
+ width: 20,
+ height: 20,
+ child: IgnorePointer(
+ child: Checkbox(
+ materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ value: _differentBilling,
+ onChanged: (_) {},
),
- )
- .toList(),
- onMenuStateChange: (isOpen) {
- if (!isOpen) {
- _billingCountrySearchController.clear();
- }
- },
- onChanged: _loadingBillingCountries
- ? null
- : (value) {
- setState(() {
- _selectedBillingCountryIso = value;
- });
- },
- hint: Text(
- _loadingBillingCountries
- ? "Loading countries..."
- : "Billing country",
- style: isDesktop
- ? STextStyles.desktopTextExtraSmall(context).copyWith(
- color: Theme.of(context)
- .extension<StackColors>()!
- .textFieldDefaultSearchIconLeft,
- )
- : STextStyles.fieldLabel(context),
- ),
- isExpanded: true,
- buttonStyleData: ButtonStyleData(
- decoration: BoxDecoration(
- color: Theme.of(
- context,
- ).extension<StackColors>()!.textFieldDefaultBG,
- borderRadius: BorderRadius.circular(
- Constants.size.circularBorderRadius,
),
),
- ),
- iconStyleData: IconStyleData(
- icon: Padding(
- padding: const EdgeInsets.only(right: 10),
- child: SvgPicture.asset(
- Assets.svg.chevronDown,
- width: 12,
- height: 6,
- color: Theme.of(context)
- .extension<StackColors>()!
- .textFieldActiveSearchIconRight,
- ),
+ const SizedBox(width: 12),
+ Text(
+ "Different billing address?",
+ style: isDesktop
+ ? STextStyles.desktopTextSmall(context)
+ : STextStyles.w500_14(context),
),
- ),
- dropdownStyleData: DropdownStyleData(
- offset: const Offset(0, 0),
- elevation: 0,
- maxHeight: 300,
- decoration: BoxDecoration(
- color: Theme.of(
- context,
- ).extension<StackColors>()!.textFieldDefaultBG,
- borderRadius: BorderRadius.circular(
- Constants.size.circularBorderRadius,
- ),
+ ],
+ ),
+ ),
+ ),
+ if (_differentBilling) ...[
+ spacing,
+ Text(
+ "Billing address",
+ style: isDesktop
+ ? STextStyles.desktopTextSmall(context)
+ : STextStyles.titleBold12(context),
+ ),
+ SizedBox(height: isDesktop ? 16 : 12),
+ _buildField(
+ controller: _billingNameController,
+ focusNode: _billingNameFocusNode,
+ label: "Full name",
+ isDesktop: isDesktop,
+ ),
+ spacing,
+ _buildField(
+ controller: _billingStreetController,
+ focusNode: _billingStreetFocusNode,
+ label: "Street address",
+ isDesktop: isDesktop,
+ ),
+ spacing,
+ Row(
+ children: [
+ Expanded(
+ child: _buildField(
+ controller: _billingCityController,
+ focusNode: _billingCityFocusNode,
+ label: "City",
+ isDesktop: isDesktop,
),
),
- dropdownSearchData: DropdownSearchData<String>(
- searchController: _billingCountrySearchController,
- searchInnerWidgetHeight: 48,
- searchInnerWidget: TextFormField(
- controller: _billingCountrySearchController,
- decoration: InputDecoration(
- isDense: true,
- contentPadding: const EdgeInsets.symmetric(
- horizontal: 16,
- vertical: 14,
- ),
- hintText: "Search...",
- hintStyle: STextStyles.fieldLabel(context),
- border: InputBorder.none,
- ),
+ SizedBox(width: isDesktop ? 16 : 12),
+ Expanded(
+ child: _buildField(
+ controller: _billingPostalCodeController,
+ focusNode: _billingPostalCodeFocusNode,
+ label: "Postal code",
+ isDesktop: isDesktop,
),
- searchMatchFn: (item, searchValue) {
- final label = _countries
- .where((c) => c['iso'] == item.value)
- .map((c) => c['label'] as String)
- .firstOrNull;
- return label?.toLowerCase().contains(
- searchValue.toLowerCase(),
- ) ??
- false;
- },
- ),
- menuItemStyleData: const MenuItemStyleData(
- padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
),
- ),
+ ],
),
- ),
+ spacing,
+ _buildCountryDropdown(
+ value: _selectedBillingCountryIso,
+ onChanged: (v) => setState(() => _selectedBillingCountryIso = v),
+ hint: "Billing country",
+ searchController: _billingCountrySearchController,
+ isDesktop: isDesktop,
+ ),
+ ],
const Spacer(),
PrimaryButton(
label: "Pay research fee",
diff --git a/lib/pages/shopinbit/shopinbit_step_4.dart b/lib/pages/shopinbit/shopinbit_step_4.dart
index bf1bb46..a066330 100644
--- a/lib/pages/shopinbit/shopinbit_step_4.dart
+++ b/lib/pages/shopinbit/shopinbit_step_4.dart
@@ -1,6 +1,7 @@
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:url_launcher/url_launcher.dart';
@@ -22,6 +23,7 @@ import '../../widgets/desktop/desktop_dialog.dart';
import '../../widgets/desktop/desktop_dialog_close_button.dart';
import '../../widgets/desktop/primary_button.dart';
import '../../widgets/desktop/secondary_button.dart';
+import '../../widgets/rounded_white_container.dart';
import '../../widgets/stack_text_field.dart';
import '../exchange_view/sub_widgets/step_row.dart';
import 'shopinbit_car_fee_view.dart';
@@ -39,11 +41,38 @@ class ShopInBitStep4 extends StatefulWidget {
}
class _ShopInBitStep4State extends State<ShopInBitStep4> {
+ // Generic form controllers.
late final TextEditingController _descriptionController;
late final FocusNode _descriptionFocusNode;
final TextEditingController _countrySearchController =
TextEditingController();
+ // Concierge-specific controllers
+ late final TextEditingController _whatToPurchaseController;
+ late final FocusNode _whatToPurchaseFocusNode;
+ late final TextEditingController _budgetController;
+ late final FocusNode _budgetFocusNode;
+ String? _selectedCondition;
+ bool _noLimit = false;
+ bool _whatToPurchaseTouched = false;
+ bool _budgetTouched = false;
+
+ // Car Research-specific controllers
+ late final TextEditingController _brandController;
+ late final FocusNode _brandFocusNode;
+ late final TextEditingController _modelController;
+ late final FocusNode _modelFocusNode;
+ late final TextEditingController _carDescriptionController;
+ late final FocusNode _carDescriptionFocusNode;
+ late final TextEditingController _carBudgetController;
+ late final FocusNode _carBudgetFocusNode;
+ String? _selectedCarCondition;
+ bool _feeAcknowledged = false;
+ bool _brandTouched = false;
+ bool _modelTouched = false;
+ bool _carDescriptionTouched = false;
+ bool _carBudgetTouched = false;
+
List<Map<String, dynamic>> _countries = [];
String? _selectedCountryIso;
bool _loadingCountries = false;
@@ -141,11 +170,42 @@ class _ShopInBitStep4State extends State<ShopInBitStep4> {
return shouldContinue ?? false;
}
- bool get _canContinue =>
- !_submitting &&
- _privacyAccepted &&
- _descriptionController.text.trim().isNotEmpty &&
- _selectedCountryIso != null;
+ bool get _budgetIsValid {
+ final text = _budgetController.text.trim();
+ if (text.isEmpty) return false;
+ final value = int.tryParse(text);
+ return value != null && value >= 1000 && value <= 100000;
+ }
+
+ bool get _canContinue {
+ final cat = widget.model.category;
+ if (cat == ShopInBitCategory.concierge) {
+ return !_submitting &&
+ _privacyAccepted &&
+ _whatToPurchaseController.text.trim().length >= 10 &&
+ _selectedCondition != null &&
+ (_noLimit || _budgetIsValid) &&
+ _selectedCountryIso != null;
+ }
+ if (cat == ShopInBitCategory.car) {
+ final carBudgetVal = int.tryParse(_carBudgetController.text.trim());
+ return !_submitting &&
+ _privacyAccepted &&
+ _feeAcknowledged &&
+ _brandController.text.trim().length >= 3 &&
+ _modelController.text.trim().length >= 3 &&
+ _carDescriptionController.text.trim().length >= 3 &&
+ _selectedCarCondition != null &&
+ carBudgetVal != null &&
+ carBudgetVal >= 20000 &&
+ _selectedCountryIso != null;
+ }
+ // travel: existing logic
+ return !_submitting &&
+ _privacyAccepted &&
+ _descriptionController.text.trim().isNotEmpty &&
+ _selectedCountryIso != null;
+ }
@override
void initState() {
@@ -155,6 +215,59 @@ class _ShopInBitStep4State extends State<ShopInBitStep4> {
);
_descriptionFocusNode = FocusNode();
_descriptionFocusNode.addListener(() => setState(() {}));
+
+ // Concierge-specific init
+ _whatToPurchaseController = TextEditingController();
+ _whatToPurchaseFocusNode = FocusNode();
+ _whatToPurchaseFocusNode.addListener(() {
+ if (!_whatToPurchaseFocusNode.hasFocus) {
+ _whatToPurchaseTouched = true;
+ }
+ setState(() {});
+ });
+ _budgetController = TextEditingController(text: "1000");
+ _budgetFocusNode = FocusNode();
+ _budgetFocusNode.addListener(() {
+ if (!_budgetFocusNode.hasFocus) {
+ _budgetTouched = true;
+ }
+ setState(() {});
+ });
+
+ // Car Research-specific init
+ _brandController = TextEditingController();
+ _brandFocusNode = FocusNode();
+ _brandFocusNode.addListener(() {
+ if (!_brandFocusNode.hasFocus) {
+ _brandTouched = true;
+ }
+ setState(() {});
+ });
+ _modelController = TextEditingController();
+ _modelFocusNode = FocusNode();
+ _modelFocusNode.addListener(() {
+ if (!_modelFocusNode.hasFocus) {
+ _modelTouched = true;
+ }
+ setState(() {});
+ });
+ _carDescriptionController = TextEditingController();
+ _carDescriptionFocusNode = FocusNode();
+ _carDescriptionFocusNode.addListener(() {
+ if (!_carDescriptionFocusNode.hasFocus) {
+ _carDescriptionTouched = true;
+ }
+ setState(() {});
+ });
+ _carBudgetController = TextEditingController();
+ _carBudgetFocusNode = FocusNode();
+ _carBudgetFocusNode.addListener(() {
+ if (!_carBudgetFocusNode.hasFocus) {
+ _carBudgetTouched = true;
+ }
+ setState(() {});
+ });
+
if (widget.model.deliveryCountry.isNotEmpty) {
_selectedCountryIso = widget.model.deliveryCountry;
}
@@ -166,6 +279,18 @@ class _ShopInBitStep4State extends State<ShopInBitStep4> {
_descriptionController.dispose();
_descriptionFocusNode.dispose();
_countrySearchController.dispose();
+ _whatToPurchaseController.dispose();
+ _whatToPurchaseFocusNode.dispose();
+ _budgetController.dispose();
+ _budgetFocusNode.dispose();
+ _brandController.dispose();
+ _brandFocusNode.dispose();
+ _modelController.dispose();
+ _modelFocusNode.dispose();
+ _carDescriptionController.dispose();
+ _carDescriptionFocusNode.dispose();
+ _carBudgetController.dispose();
+ _carBudgetFocusNode.dispose();
super.dispose();
}
@@ -195,7 +320,36 @@ class _ShopInBitStep4State extends State<ShopInBitStep4> {
}
Future<void> _submit() async {
- widget.model.requestDescription = _descriptionController.text.trim();
+ // Format structured comment for Concierge
+ if (widget.model.category == ShopInBitCategory.concierge) {
+ final budgetText =
+ _noLimit ? "No limit" : "${_budgetController.text.trim()} EUR";
+ final countryLabel = _countries
+ .where((c) => c['iso'] == _selectedCountryIso)
+ .map((c) => c['label'] as String)
+ .firstOrNull ??
+ _selectedCountryIso!;
+ widget.model.requestDescription =
+ "What to purchase: ${_whatToPurchaseController.text.trim()}\n"
+ "Condition: $_selectedCondition\n"
+ "Budget: $budgetText\n"
+ "Delivery country: $countryLabel";
+ } else if (widget.model.category == ShopInBitCategory.car) {
+ final countryLabel = _countries
+ .where((c) => c['iso'] == _selectedCountryIso)
+ .map((c) => c['label'] as String)
+ .firstOrNull ??
+ _selectedCountryIso!;
+ widget.model.requestDescription =
+ "Brand: ${_brandController.text.trim()}\n"
+ "Model: ${_modelController.text.trim()}\n"
+ "Condition: $_selectedCarCondition\n"
+ "Description: ${_carDescriptionController.text.trim()}\n"
+ "Budget: ${_carBudgetController.text.trim()} EUR\n"
+ "Delivery country: $countryLabel";
+ } else {
+ widget.model.requestDescription = _descriptionController.text.trim();
+ }
widget.model.deliveryCountry = _selectedCountryIso!;
if (widget.model.category == ShopInBitCategory.car) {
@@ -292,16 +446,220 @@ class _ShopInBitStep4State extends State<ShopInBitStep4> {
}
}
- @override
- Widget build(BuildContext context) {
- final isDesktop = Util.isDesktop;
+ // Shared widgets.
+ Widget _buildCountryPicker(bool isDesktop) {
+ return ClipRRect(
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius,
+ ),
+ child: DropdownButtonHideUnderline(
+ child: DropdownButton2<String>(
+ value: _selectedCountryIso,
+ items: _countries
+ .map(
+ (c) => DropdownMenuItem<String>(
+ value: c['iso'] as String,
+ child: Text(
+ c['label'] as String,
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(
+ context,
+ ).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldActiveText,
+ )
+ : STextStyles.w500_14(context),
+ ),
+ ),
+ )
+ .toList(),
+ onMenuStateChange: (isOpen) {
+ if (!isOpen) {
+ _countrySearchController.clear();
+ }
+ },
+ onChanged: _loadingCountries
+ ? null
+ : (value) {
+ setState(() {
+ _selectedCountryIso = value;
+ });
+ },
+ hint: Text(
+ _loadingCountries ? "Loading countries..." : "Delivery country",
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(context).copyWith(
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .textFieldDefaultSearchIconLeft,
+ )
+ : STextStyles.fieldLabel(context),
+ ),
+ isExpanded: true,
+ buttonStyleData: ButtonStyleData(
+ decoration: BoxDecoration(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius,
+ ),
+ ),
+ ),
+ iconStyleData: IconStyleData(
+ icon: Padding(
+ padding: const EdgeInsets.only(right: 10),
+ child: SvgPicture.asset(
+ Assets.svg.chevronDown,
+ width: 12,
+ height: 6,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldActiveSearchIconRight,
+ ),
+ ),
+ ),
+ dropdownStyleData: DropdownStyleData(
+ offset: const Offset(0, 0),
+ elevation: 0,
+ maxHeight: 300,
+ decoration: BoxDecoration(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius,
+ ),
+ ),
+ ),
+ dropdownSearchData: DropdownSearchData<String>(
+ searchController: _countrySearchController,
+ searchInnerWidgetHeight: 48,
+ searchInnerWidget: TextFormField(
+ controller: _countrySearchController,
+ decoration: InputDecoration(
+ isDense: true,
+ contentPadding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ vertical: 14,
+ ),
+ hintText: "Search...",
+ hintStyle: STextStyles.fieldLabel(context),
+ border: InputBorder.none,
+ ),
+ ),
+ searchMatchFn: (item, searchValue) {
+ final label = _countries
+ .where((c) => c['iso'] == item.value)
+ .map((c) => c['label'] as String)
+ .firstOrNull;
+ return label?.toLowerCase().contains(
+ searchValue.toLowerCase(),
+ ) ??
+ false;
+ },
+ ),
+ menuItemStyleData: const MenuItemStyleData(
+ padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
+ ),
+ ),
+ ),
+ );
+ }
- final String descriptionPlaceholder =
- widget.model.category == ShopInBitCategory.car
- ? "Describe the car (make, model, year, requirements)"
- : "What would you like to purchase?";
+ Widget _buildPrivacyCheckbox(bool isDesktop) {
+ return GestureDetector(
+ onTap: () {
+ setState(() {
+ _privacyAccepted = !_privacyAccepted;
+ });
+ },
+ child: Container(
+ color: Colors.transparent,
+ child: Row(
+ crossAxisAlignment: isDesktop
+ ? CrossAxisAlignment.center
+ : CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: EdgeInsets.only(top: isDesktop ? 3 : 0),
+ child: SizedBox(
+ width: 20,
+ height: 20,
+ child: IgnorePointer(
+ child: Checkbox(
+ materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ value: _privacyAccepted,
+ onChanged: (_) {},
+ ),
+ ),
+ ),
+ ),
+ const SizedBox(width: 12),
+ Expanded(
+ child: RichText(
+ text: TextSpan(
+ style: isDesktop
+ ? STextStyles.desktopTextSmall(context)
+ : STextStyles.w500_14(context),
+ children: [
+ const TextSpan(
+ text: "I have read and agree to the ShopinBit ",
+ ),
+ TextSpan(
+ text: "Privacy Policy",
+ style: STextStyles.richLink(
+ context,
+ ).copyWith(fontSize: isDesktop ? 18 : 14),
+ recognizer: TapGestureRecognizer()
+ ..onTap = () async {
+ const url =
+ "https://api.shopinbit.com/static/policy/privacy.html";
+ final shouldOpen = await _showOpenBrowserWarning(
+ context,
+ url,
+ );
+ if (shouldOpen) {
+ await launchUrl(
+ Uri.parse(url),
+ mode: LaunchMode.externalApplication,
+ );
+ }
+ },
+ ),
+ const TextSpan(text: "."),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ Widget _buildSubmitButton() {
+ return PrimaryButton(
+ label: _submitting ? "Submitting..." : "Submit request",
+ enabled: _canContinue,
+ onPressed: _canContinue ? _submit : null,
+ );
+ }
+
+ // Per-category form builders.
+
+ Widget _buildConciergeContent(bool isDesktop) {
+ final whatToPurchaseError = _whatToPurchaseTouched &&
+ _whatToPurchaseController.text.trim().length < 10
+ ? "Minimum 10 characters"
+ : null;
- final content = Column(
+ final budgetError = _budgetTouched && !_noLimit && !_budgetIsValid
+ ? "Enter a value between 1,000 and 100,000"
+ : null;
+
+ return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
if (!isDesktop)
@@ -312,95 +670,382 @@ class _ShopInBitStep4State extends State<ShopInBitStep4> {
),
if (!isDesktop) const SizedBox(height: 14),
Text(
- "Describe your request",
+ "What would you like to purchase?",
style: isDesktop
? STextStyles.desktopH2(context)
: STextStyles.pageTitleH1(context),
),
SizedBox(height: isDesktop ? 16 : 8),
Text(
- "Provide details about what you'd like to purchase.",
+ "Tell us what you're looking for and we'll find it for you.",
style: isDesktop
? STextStyles.desktopTextSmall(context)
: STextStyles.itemSubtitle(context),
),
SizedBox(height: isDesktop ? 32 : 24),
+
+ // What to purchase free-text field
+ TextField(
+ controller: _whatToPurchaseController,
+ focusNode: _whatToPurchaseFocusNode,
+ autocorrect: false,
+ enableSuggestions: false,
+ minLines: 3,
+ maxLines: 6,
+ onChanged: (_) => setState(() {}),
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(context).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldActiveText,
+ height: 1.8,
+ )
+ : STextStyles.field(context),
+ decoration:
+ standardInputDecoration(
+ "Describe what you'd like to purchase (e.g., electronics, luxury goods, services...)",
+ _whatToPurchaseFocusNode,
+ context,
+ desktopMed: isDesktop,
+ ).copyWith(
+ filled: true,
+ contentPadding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ vertical: 12,
+ ),
+ errorText: whatToPurchaseError,
+ ),
+ ),
+ SizedBox(height: isDesktop ? 24 : 16),
+
+ // Condition picker
ClipRRect(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
- child: TextField(
- controller: _descriptionController,
- focusNode: _descriptionFocusNode,
- autocorrect: false,
- enableSuggestions: false,
- minLines: 3,
- maxLines: 6,
- onChanged: (_) => setState(() {}),
- style: isDesktop
- ? STextStyles.desktopTextExtraSmall(context).copyWith(
+ child: DropdownButtonHideUnderline(
+ child: DropdownButton2<String>(
+ value: _selectedCondition,
+ items: ["NEW", "USED"]
+ .map(
+ (c) => DropdownMenuItem<String>(
+ value: c,
+ child: Text(
+ c,
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(
+ context,
+ ).copyWith(
+ color: Theme.of(
+ context,
+ )
+ .extension<StackColors>()!
+ .textFieldActiveText,
+ )
+ : STextStyles.w500_14(context),
+ ),
+ ),
+ )
+ .toList(),
+ onChanged: (value) {
+ setState(() {
+ _selectedCondition = value;
+ });
+ },
+ hint: Text(
+ "Condition",
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(context).copyWith(
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .textFieldDefaultSearchIconLeft,
+ )
+ : STextStyles.fieldLabel(context),
+ ),
+ isExpanded: true,
+ buttonStyleData: ButtonStyleData(
+ decoration: BoxDecoration(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius,
+ ),
+ ),
+ ),
+ iconStyleData: IconStyleData(
+ icon: Padding(
+ padding: const EdgeInsets.only(right: 10),
+ child: SvgPicture.asset(
+ Assets.svg.chevronDown,
+ width: 12,
+ height: 6,
color: Theme.of(
context,
- ).extension<StackColors>()!.textFieldActiveText,
- height: 1.8,
- )
- : STextStyles.field(context),
- decoration:
- standardInputDecoration(
- descriptionPlaceholder,
- _descriptionFocusNode,
- context,
- desktopMed: isDesktop,
- ).copyWith(
- filled: true,
- contentPadding: const EdgeInsets.symmetric(
- horizontal: 16,
- vertical: 12,
+ ).extension<StackColors>()!.textFieldActiveSearchIconRight,
),
),
+ ),
+ dropdownStyleData: DropdownStyleData(
+ offset: const Offset(0, 0),
+ elevation: 0,
+ decoration: BoxDecoration(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius,
+ ),
+ ),
+ ),
+ menuItemStyleData: const MenuItemStyleData(
+ padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
+ ),
+ ),
),
),
SizedBox(height: isDesktop ? 24 : 16),
+
+ // Budget field
+ TextField(
+ controller: _budgetController,
+ focusNode: _budgetFocusNode,
+ autocorrect: false,
+ enableSuggestions: false,
+ enabled: !_noLimit,
+ keyboardType: TextInputType.number,
+ inputFormatters: [FilteringTextInputFormatter.digitsOnly],
+ onChanged: (_) => setState(() {}),
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(context).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldActiveText,
+ height: 1.8,
+ )
+ : STextStyles.field(context),
+ decoration:
+ standardInputDecoration(
+ "Budget (\u20AC)",
+ _budgetFocusNode,
+ context,
+ desktopMed: isDesktop,
+ ).copyWith(
+ filled: true,
+ contentPadding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ vertical: 12,
+ ),
+ suffixText: "\u20AC",
+ errorText: budgetError,
+ ),
+ ),
+ SizedBox(height: isDesktop ? 12 : 8),
+
+ // No budget limit checkbox
+ GestureDetector(
+ onTap: () {
+ setState(() {
+ _noLimit = !_noLimit;
+ });
+ },
+ child: Container(
+ color: Colors.transparent,
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ SizedBox(
+ width: 20,
+ height: 20,
+ child: IgnorePointer(
+ child: Checkbox(
+ materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ value: _noLimit,
+ onChanged: (_) {},
+ ),
+ ),
+ ),
+ const SizedBox(width: 12),
+ Text(
+ "No budget limit",
+ style: isDesktop
+ ? STextStyles.desktopTextSmall(context)
+ : STextStyles.w500_14(context),
+ ),
+ ],
+ ),
+ ),
+ ),
+ SizedBox(height: isDesktop ? 24 : 16),
+
+ // Country picker (shared)
+ _buildCountryPicker(isDesktop),
+ SizedBox(height: isDesktop ? 16 : 12),
+
+ // Privacy checkbox (shared)
+ _buildPrivacyCheckbox(isDesktop),
+ SizedBox(height: isDesktop ? 16 : 12),
+
+ // Submit button (shared)
+ _buildSubmitButton(),
+ ],
+ );
+ }
+
+ Widget _buildCarContent(bool isDesktop) {
+ final brandError =
+ _brandTouched && _brandController.text.trim().length < 3
+ ? "Minimum 3 characters"
+ : null;
+
+ final modelError =
+ _modelTouched && _modelController.text.trim().length < 3
+ ? "Minimum 3 characters"
+ : null;
+
+ final carDescriptionError = _carDescriptionTouched &&
+ _carDescriptionController.text.trim().length < 3
+ ? "Minimum 3 characters"
+ : null;
+
+ final carBudgetText = _carBudgetController.text.trim();
+ final carBudgetVal = int.tryParse(carBudgetText);
+ final carBudgetError = _carBudgetTouched &&
+ (carBudgetText.isEmpty ||
+ carBudgetVal == null ||
+ carBudgetVal < 20000)
+ ? "Minimum budget is 20,000\u20AC"
+ : null;
+
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ if (!isDesktop)
+ StepRow(
+ count: 4,
+ current: 3,
+ width: MediaQuery.of(context).size.width - 32,
+ ),
+ if (!isDesktop) const SizedBox(height: 14),
+ Text(
+ "Car Research request",
+ style: isDesktop
+ ? STextStyles.desktopH2(context)
+ : STextStyles.pageTitleH1(context),
+ ),
+ SizedBox(height: isDesktop ? 16 : 8),
+ Text(
+ "Tell us about the car you're looking for.",
+ style: isDesktop
+ ? STextStyles.desktopTextSmall(context)
+ : STextStyles.itemSubtitle(context),
+ ),
+ SizedBox(height: isDesktop ? 32 : 24),
+
+ // Country picker (shared)
+ _buildCountryPicker(isDesktop),
+ SizedBox(height: isDesktop ? 24 : 16),
+
+ // Brand field
+ TextField(
+ controller: _brandController,
+ focusNode: _brandFocusNode,
+ autocorrect: false,
+ enableSuggestions: false,
+ onChanged: (_) => setState(() {}),
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(context).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldActiveText,
+ height: 1.8,
+ )
+ : STextStyles.field(context),
+ decoration:
+ standardInputDecoration(
+ "Car brand (e.g., BMW, Mercedes, Toyota...)",
+ _brandFocusNode,
+ context,
+ desktopMed: isDesktop,
+ ).copyWith(
+ filled: true,
+ contentPadding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ vertical: 12,
+ ),
+ errorText: brandError,
+ ),
+ ),
+ SizedBox(height: isDesktop ? 24 : 16),
+
+ // Model field
+ TextField(
+ controller: _modelController,
+ focusNode: _modelFocusNode,
+ autocorrect: false,
+ enableSuggestions: false,
+ onChanged: (_) => setState(() {}),
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(context).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldActiveText,
+ height: 1.8,
+ )
+ : STextStyles.field(context),
+ decoration:
+ standardInputDecoration(
+ "Car model (e.g., 3 Series, E-Class, Camry...)",
+ _modelFocusNode,
+ context,
+ desktopMed: isDesktop,
+ ).copyWith(
+ filled: true,
+ contentPadding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ vertical: 12,
+ ),
+ errorText: modelError,
+ ),
+ ),
+ SizedBox(height: isDesktop ? 24 : 16),
+
+ // Condition picker
ClipRRect(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
child: DropdownButtonHideUnderline(
child: DropdownButton2<String>(
- value: _selectedCountryIso,
- items: _countries
+ value: _selectedCarCondition,
+ items: ["NEW", "PREOWNED"]
.map(
(c) => DropdownMenuItem<String>(
- value: c['iso'] as String,
+ value: c,
child: Text(
- c['label'] as String,
+ c,
style: isDesktop
? STextStyles.desktopTextExtraSmall(
context,
).copyWith(
color: Theme.of(
context,
- ).extension<StackColors>()!.textFieldActiveText,
+ )
+ .extension<StackColors>()!
+ .textFieldActiveText,
)
: STextStyles.w500_14(context),
),
),
)
.toList(),
- onMenuStateChange: (isOpen) {
- if (!isOpen) {
- _countrySearchController.clear();
- }
+ onChanged: (value) {
+ setState(() {
+ _selectedCarCondition = value;
+ });
},
- onChanged: _loadingCountries
- ? null
- : (value) {
- setState(() {
- _selectedCountryIso = value;
- });
- },
hint: Text(
- _loadingCountries ? "Loading countries..." : "Delivery country",
+ "Condition",
style: isDesktop
? STextStyles.desktopTextExtraSmall(context).copyWith(
color: Theme.of(context)
@@ -436,7 +1081,6 @@ class _ShopInBitStep4State extends State<ShopInBitStep4> {
dropdownStyleData: DropdownStyleData(
offset: const Offset(0, 0),
elevation: 0,
- maxHeight: 300,
decoration: BoxDecoration(
color: Theme.of(
context,
@@ -446,102 +1090,156 @@ class _ShopInBitStep4State extends State<ShopInBitStep4> {
),
),
),
- dropdownSearchData: DropdownSearchData<String>(
- searchController: _countrySearchController,
- searchInnerWidgetHeight: 48,
- searchInnerWidget: TextFormField(
- controller: _countrySearchController,
- decoration: InputDecoration(
- isDense: true,
- contentPadding: const EdgeInsets.symmetric(
- horizontal: 16,
- vertical: 14,
- ),
- hintText: "Search...",
- hintStyle: STextStyles.fieldLabel(context),
- border: InputBorder.none,
- ),
- ),
- searchMatchFn: (item, searchValue) {
- final label = _countries
- .where((c) => c['iso'] == item.value)
- .map((c) => c['label'] as String)
- .firstOrNull;
- return label?.toLowerCase().contains(
- searchValue.toLowerCase(),
- ) ??
- false;
- },
- ),
menuItemStyleData: const MenuItemStyleData(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
),
),
),
),
+ SizedBox(height: isDesktop ? 24 : 16),
+
+ // Description field (multiline)
+ TextField(
+ controller: _carDescriptionController,
+ focusNode: _carDescriptionFocusNode,
+ autocorrect: false,
+ enableSuggestions: false,
+ minLines: 3,
+ maxLines: 6,
+ onChanged: (_) => setState(() {}),
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(context).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldActiveText,
+ height: 1.8,
+ )
+ : STextStyles.field(context),
+ decoration:
+ standardInputDecoration(
+ "Describe your requirements (year, mileage, features...)",
+ _carDescriptionFocusNode,
+ context,
+ desktopMed: isDesktop,
+ ).copyWith(
+ filled: true,
+ contentPadding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ vertical: 12,
+ ),
+ errorText: carDescriptionError,
+ ),
+ ),
+ SizedBox(height: isDesktop ? 24 : 16),
+
+ // Budget field
+ TextField(
+ controller: _carBudgetController,
+ focusNode: _carBudgetFocusNode,
+ autocorrect: false,
+ enableSuggestions: false,
+ keyboardType: TextInputType.number,
+ inputFormatters: [FilteringTextInputFormatter.digitsOnly],
+ onChanged: (_) => setState(() {}),
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(context).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldActiveText,
+ height: 1.8,
+ )
+ : STextStyles.field(context),
+ decoration:
+ standardInputDecoration(
+ "Budget (\u20AC, minimum 20,000)",
+ _carBudgetFocusNode,
+ context,
+ desktopMed: isDesktop,
+ ).copyWith(
+ filled: true,
+ contentPadding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ vertical: 12,
+ ),
+ suffixText: "\u20AC",
+ errorText: carBudgetError,
+ ),
+ ),
+ SizedBox(height: isDesktop ? 24 : 16),
+
+ // Research fee info box
+ RoundedWhiteContainer(
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Icon(
+ Icons.info_outline,
+ size: 20,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldActiveSearchIconLeft,
+ ),
+ const SizedBox(width: 12),
+ Expanded(
+ child: RichText(
+ text: TextSpan(
+ style: isDesktop
+ ? STextStyles.desktopTextSmall(context)
+ : STextStyles.w500_14(context),
+ children: [
+ TextSpan(
+ text: "Research fee: ",
+ style: isDesktop
+ ? STextStyles.desktopTextSmall(context).copyWith(
+ fontWeight: FontWeight.bold,
+ )
+ : STextStyles.w500_14(context).copyWith(
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ const TextSpan(
+ text:
+ "\u20AC223 (incl. VAT): one-time payment, credited toward your purchase.",
+ ),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
SizedBox(height: isDesktop ? 16 : 12),
+
+ // Fee acknowledgement checkbox
GestureDetector(
onTap: () {
setState(() {
- _privacyAccepted = !_privacyAccepted;
+ _feeAcknowledged = !_feeAcknowledged;
});
},
child: Container(
color: Colors.transparent,
child: Row(
- crossAxisAlignment: isDesktop
- ? CrossAxisAlignment.center
- : CrossAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.center,
children: [
- Padding(
- padding: EdgeInsets.only(top: isDesktop ? 3 : 0),
- child: SizedBox(
- width: 20,
- height: 20,
- child: IgnorePointer(
- child: Checkbox(
- materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
- value: _privacyAccepted,
- onChanged: (_) {},
- ),
+ SizedBox(
+ width: 20,
+ height: 20,
+ child: IgnorePointer(
+ child: Checkbox(
+ materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ value: _feeAcknowledged,
+ onChanged: (_) {},
),
),
),
const SizedBox(width: 12),
Expanded(
- child: RichText(
- text: TextSpan(
- style: isDesktop
- ? STextStyles.desktopTextSmall(context)
- : STextStyles.w500_14(context),
- children: [
- const TextSpan(
- text: "I have read and agree to the ShopinBit ",
- ),
- TextSpan(
- text: "Privacy Policy",
- style: STextStyles.richLink(
- context,
- ).copyWith(fontSize: isDesktop ? 18 : 14),
- recognizer: TapGestureRecognizer()
- ..onTap = () async {
- const url =
- "https://api.shopinbit.com/static/policy/privacy.html";
- final shouldOpen = await _showOpenBrowserWarning(
- context,
- url,
- );
- if (shouldOpen) {
- await launchUrl(
- Uri.parse(url),
- mode: LaunchMode.externalApplication,
- );
- }
- },
- ),
- const TextSpan(text: "."),
- ],
- ),
+ child: Text(
+ "I acknowledge the \u20AC223 research fee",
+ style: isDesktop
+ ? STextStyles.desktopTextSmall(context)
+ : STextStyles.w500_14(context),
),
),
],
@@ -549,13 +1247,116 @@ class _ShopInBitStep4State extends State<ShopInBitStep4> {
),
),
SizedBox(height: isDesktop ? 16 : 12),
- PrimaryButton(
- label: _submitting ? "Submitting..." : "Submit request",
- enabled: _canContinue,
- onPressed: _canContinue ? _submit : null,
+
+ // Privacy checkbox (shared)
+ _buildPrivacyCheckbox(isDesktop),
+ SizedBox(height: isDesktop ? 16 : 12),
+
+ // Submit button (shared)
+ _buildSubmitButton(),
+ ],
+ );
+ }
+
+ Widget _buildGenericContent(bool isDesktop) {
+ // Travel uses the generic form; Concierge and Car have dedicated builders.
+ const descriptionTitle = "Describe your travel request";
+ const descriptionSubtitle = "Provide details about your trip.";
+ const descriptionPlaceholder =
+ "Describe your travel request (destinations, dates, passengers)";
+
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ if (!isDesktop)
+ StepRow(
+ count: 4,
+ current: 3,
+ width: MediaQuery.of(context).size.width - 32,
+ ),
+ if (!isDesktop) const SizedBox(height: 14),
+ Text(
+ descriptionTitle,
+ style: isDesktop
+ ? STextStyles.desktopH2(context)
+ : STextStyles.pageTitleH1(context),
+ ),
+ SizedBox(height: isDesktop ? 16 : 8),
+ Text(
+ descriptionSubtitle,
+ style: isDesktop
+ ? STextStyles.desktopTextSmall(context)
+ : STextStyles.itemSubtitle(context),
+ ),
+ SizedBox(height: isDesktop ? 32 : 24),
+ ClipRRect(
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius,
+ ),
+ child: TextField(
+ controller: _descriptionController,
+ focusNode: _descriptionFocusNode,
+ autocorrect: false,
+ enableSuggestions: false,
+ minLines: 3,
+ maxLines: 6,
+ onChanged: (_) => setState(() {}),
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(context).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldActiveText,
+ height: 1.8,
+ )
+ : STextStyles.field(context),
+ decoration:
+ standardInputDecoration(
+ descriptionPlaceholder,
+ _descriptionFocusNode,
+ context,
+ desktopMed: isDesktop,
+ ).copyWith(
+ filled: true,
+ contentPadding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ vertical: 12,
+ ),
+ ),
+ ),
),
+ SizedBox(height: isDesktop ? 24 : 16),
+
+ // Country picker (shared)
+ _buildCountryPicker(isDesktop),
+ SizedBox(height: isDesktop ? 16 : 12),
+
+ // Privacy checkbox (shared)
+ _buildPrivacyCheckbox(isDesktop),
+ SizedBox(height: isDesktop ? 16 : 12),
+
+ // Submit button (shared)
+ _buildSubmitButton(),
],
);
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final isDesktop = Util.isDesktop;
+
+ final Widget content;
+ switch (widget.model.category) {
+ case ShopInBitCategory.concierge:
+ content = _buildConciergeContent(isDesktop);
+ break;
+ case ShopInBitCategory.car:
+ content = _buildCarContent(isDesktop);
+ break;
+ case ShopInBitCategory.travel:
+ case null:
+ content = _buildGenericContent(isDesktop);
+ break;
+ }
if (isDesktop) {
return DesktopDialog(
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.