What changed, and why it matters
This commit is a routine user-interface styling fix. It swaps the standard Flutter date picker for a custom Stack Wallet date picker in a travel booking form and makes the custom picker accept optional start/end date limits. There is no security-relevant change visible in the code.
No security action required. Review as normal UI code if desired.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors date selection in shopinbit_travel_form.dart to call showSWDatePicker instead of Flutter’s showDatePicker, passing firstDate and lastDate parameters. It also updates showSWDatePicker in date_picker.dart to accept optional firstDate, lastDate, and currentDate arguments, falling back to prior defaults. The remaining changes are formatting and style adjustments (button padding, color assignments, inset padding). No input validation, cryptographic, authentication, authorization, or network changes are present.
Changed components
lib/pages/shopinbit/step_4_components/shopinbit_travel_form.dartlib/widgets/date_picker/date_picker.dartInspect captured patch +23 / −22
diff --git a/lib/pages/shopinbit/step_4_components/shopinbit_travel_form.dart b/lib/pages/shopinbit/step_4_components/shopinbit_travel_form.dart
index dc5c9c9..8fa5fd1 100644
--- a/lib/pages/shopinbit/step_4_components/shopinbit_travel_form.dart
+++ b/lib/pages/shopinbit/step_4_components/shopinbit_travel_form.dart
@@ -7,6 +7,7 @@ import "../../../providers/db/drift_provider.dart";
import "../../../providers/global/shopin_bit_service_provider.dart";
import "../../../utilities/text_styles.dart";
import "../../../utilities/util.dart";
+import "../../../widgets/date_picker/date_picker.dart";
import "../../../widgets/textfields/adaptive_text_field.dart";
import "shopinbit_country_picker.dart";
import "shopinbit_labeled_checkbox.dart";
@@ -199,11 +200,11 @@ class _ShopInBitTravelFormState extends ConsumerState<ShopInBitTravelForm> {
TextEditingController target,
VoidCallback onPicked,
) async {
- final DateTime? picked = await showDatePicker(
- context: context,
- initialDate: DateTime.now(),
- firstDate: DateTime.now(),
- lastDate: DateTime.now().add(const Duration(days: 3650)),
+ final now = DateTime.now();
+ final DateTime? picked = await showSWDatePicker(
+ context,
+ firstDate: now,
+ lastDate: now.add(const Duration(days: 3650)),
);
if (picked != null) {
setState(() {
diff --git a/lib/widgets/date_picker/date_picker.dart b/lib/widgets/date_picker/date_picker.dart
index 328e2c0..f258a38 100644
--- a/lib/widgets/date_picker/date_picker.dart
+++ b/lib/widgets/date_picker/date_picker.dart
@@ -12,7 +12,12 @@ import '../desktop/secondary_button.dart';
part 'sw_date_picker.dart';
-Future<DateTime?> showSWDatePicker(BuildContext context) async {
+Future<DateTime?> showSWDatePicker(
+ BuildContext context, {
+ DateTime? firstDate,
+ DateTime? lastDate,
+ DateTime? currentDate,
+}) async {
final Size size;
if (Util.isDesktop) {
size = const Size(450, 450);
@@ -31,19 +36,17 @@ Future<DateTime?> showSWDatePicker(BuildContext context) async {
value: [now],
dialogSize: size,
config: CalendarDatePicker2WithActionButtonsConfig(
- firstDate: DateTime(2007),
- lastDate: now,
- currentDate: now,
- buttonPadding: const EdgeInsets.only(
- right: 16,
- ),
+ firstDate: firstDate ?? DateTime(2007),
+ lastDate: lastDate ?? now,
+ currentDate: currentDate ?? now,
+ buttonPadding: const EdgeInsets.only(right: 16),
centerAlignModePicker: true,
- selectedDayHighlightColor:
- Theme.of(context).extension<StackColors>()!.accentColorDark,
- daySplashColor: Theme.of(context)
- .extension<StackColors>()!
- .accentColorDark
- .withOpacity(0.6),
+ selectedDayHighlightColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
+ daySplashColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark.withOpacity(0.6),
),
);
return date?.first;
@@ -63,10 +66,7 @@ Future<List<DateTime?>?> _showDatePickerDialog({
TransitionBuilder? builder,
}) {
final dialog = Dialog(
- insetPadding: const EdgeInsets.symmetric(
- horizontal: 16,
- vertical: 16,
- ),
+ insetPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
backgroundColor: Theme.of(context).extension<StackColors>()!.popupBG,
surfaceTintColor: Colors.transparent,
shadowColor: Colors.transparent,
Why this scored 15/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.