feat(ui): date picker range selection
What changed, and why it matters
This commit is a routine user-interface feature update. It extends the app's custom date picker so it can optionally return a date range instead of a single date, and updates the existing call sites to keep using only the first selected date. There is no security-relevant change visible in the diff.
No security action required. Treat as normal UI feature code review.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change refactors showSWDatePicker to return Future<List<DateTime?>?> and adds a range parameter that, when true, enables range selection in the underlying _showDatePickerDialog via calendarType: .range and rangeBidirectional: false. All existing callers are updated to take .first from the returned list, preserving single-date behavior. The remaining diff is formatting (trailing-comma style changes) with no functional impact.
Changed components
lib/widgets/date_picker/date_picker.dartlib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dartlib/pages/ordinals/ordinals_filter_view.dartlib/pages/shopinbit/step_4_components/shopinbit_travel_form.dartlib/pages/wallet_view/transaction_views/transaction_search_filter_view.dartInspect captured patch +312 / −364
diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart
index c44c5f2..e650564 100644
--- a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart
+++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart
@@ -178,7 +178,7 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
}
if (mounted) {
- final date = await showSWDatePicker(context);
+ final date = (await showSWDatePicker(context))?.first;
if (date != null) {
_restoreFromDate = date;
_dateController.text = Format.formatDate(date);
@@ -187,7 +187,7 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
}
Future<void> chooseDesktopDate() async {
- final date = await showSWDatePicker(context);
+ final date = (await showSWDatePicker(context))?.first;
if (date != null) {
_restoreFromDate = date;
_dateController.text = Format.formatDate(date);
diff --git a/lib/pages/ordinals/ordinals_filter_view.dart b/lib/pages/ordinals/ordinals_filter_view.dart
index 93c7e0d..660a0f8 100644
--- a/lib/pages/ordinals/ordinals_filter_view.dart
+++ b/lib/pages/ordinals/ordinals_filter_view.dart
@@ -125,10 +125,9 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
return Text(
isDateSelected ? "From..." : _fromDateString,
style: STextStyles.fieldLabel(context).copyWith(
- color:
- isDateSelected
- ? Theme.of(context).extension<StackColors>()!.textSubtitle2
- : Theme.of(context).extension<StackColors>()!.accentColorDark,
+ color: isDateSelected
+ ? Theme.of(context).extension<StackColors>()!.textSubtitle2
+ : Theme.of(context).extension<StackColors>()!.accentColorDark,
),
);
}
@@ -138,10 +137,9 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
return Text(
isDateSelected ? "To..." : _toDateString,
style: STextStyles.fieldLabel(context).copyWith(
- color:
- isDateSelected
- ? Theme.of(context).extension<StackColors>()!.textSubtitle2
- : Theme.of(context).extension<StackColors>()!.accentColorDark,
+ color: isDateSelected
+ ? Theme.of(context).extension<StackColors>()!.textSubtitle2
+ : Theme.of(context).extension<StackColors>()!.accentColorDark,
),
);
}
@@ -154,14 +152,13 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
const middleSeparatorWidth = 12.0;
final isDesktop = Util.isDesktop;
- final width =
- isDesktop
- ? null
- : (MediaQuery.of(context).size.width -
- (middleSeparatorWidth +
- (2 * middleSeparatorPadding) +
- (2 * Constants.size.standardPadding))) /
- 2;
+ final width = isDesktop
+ ? null
+ : (MediaQuery.of(context).size.width -
+ (middleSeparatorWidth +
+ (2 * middleSeparatorPadding) +
+ (2 * Constants.size.standardPadding))) /
+ 2;
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -177,7 +174,7 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
}
if (mounted) {
- final date = await showSWDatePicker(context);
+ final date = (await showSWDatePicker(context))?.first;
if (date != null) {
_selectedFromDate = date;
@@ -193,15 +190,13 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
setState(() {
if (flag) {
- _toDateString =
- _selectedToDate == null
- ? ""
- : Format.formatDate(_selectedToDate!);
+ _toDateString = _selectedToDate == null
+ ? ""
+ : Format.formatDate(_selectedToDate!);
}
- _fromDateString =
- _selectedFromDate == null
- ? ""
- : Format.formatDate(_selectedFromDate!);
+ _fromDateString = _selectedFromDate == null
+ ? ""
+ : Format.formatDate(_selectedFromDate!);
});
}
}
@@ -209,18 +204,16 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
child: Container(
width: width,
decoration: BoxDecoration(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textFieldDefaultBG,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
border: Border.all(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textFieldDefaultBG,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
width: 1,
),
),
@@ -235,10 +228,9 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
Assets.svg.calendar,
height: 20,
width: 20,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textSubtitle2,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textSubtitle2,
),
const SizedBox(width: 10),
Align(
@@ -272,7 +264,7 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
}
if (mounted) {
- final date = await showSWDatePicker(context);
+ final date = (await showSWDatePicker(context))?.first;
if (date != null) {
_selectedToDate = date;
@@ -288,15 +280,13 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
setState(() {
if (flag) {
- _fromDateString =
- _selectedFromDate == null
- ? ""
- : Format.formatDate(_selectedFromDate!);
+ _fromDateString = _selectedFromDate == null
+ ? ""
+ : Format.formatDate(_selectedFromDate!);
}
- _toDateString =
- _selectedToDate == null
- ? ""
- : Format.formatDate(_selectedToDate!);
+ _toDateString = _selectedToDate == null
+ ? ""
+ : Format.formatDate(_selectedToDate!);
});
}
}
@@ -304,18 +294,16 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
child: Container(
width: width,
decoration: BoxDecoration(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textFieldDefaultBG,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
border: Border.all(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textFieldDefaultBG,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
width: 1,
),
),
@@ -330,10 +318,9 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
Assets.svg.calendar,
height: 20,
width: 20,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textSubtitle2,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textSubtitle2,
),
const SizedBox(width: 10),
Align(
@@ -365,11 +352,13 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
} else {
return Background(
child: Scaffold(
- backgroundColor:
- Theme.of(context).extension<StackColors>()!.background,
+ backgroundColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
appBar: AppBar(
- backgroundColor:
- Theme.of(context).extension<StackColors>()!.background,
+ backgroundColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
leading: AppBarBackButton(
onPressed: () async {
if (FocusScope.of(context).hasFocus) {
@@ -573,10 +562,9 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
child: FittedBox(
child: Text(
"Date",
- style:
- isDesktop
- ? STextStyles.labelExtraExtraSmall(context)
- : STextStyles.smallMed12(context),
+ style: isDesktop
+ ? STextStyles.labelExtraExtraSmall(context)
+ : STextStyles.smallMed12(context),
),
),
),
@@ -588,10 +576,9 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
child: FittedBox(
child: Text(
"Inscription",
- style:
- isDesktop
- ? STextStyles.labelExtraExtraSmall(context)
- : STextStyles.smallMed12(context),
+ style: isDesktop
+ ? STextStyles.labelExtraExtraSmall(context)
+ : STextStyles.smallMed12(context),
),
),
),
@@ -609,51 +596,49 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
controller: _inscriptionTextEditingController,
focusNode: inscriptionTextFieldFocusNode,
onChanged: (_) => setState(() {}),
- style:
- isDesktop
- ? STextStyles.desktopTextExtraSmall(context).copyWith(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textDark,
- height: 1.8,
- )
- : STextStyles.field(context),
- decoration: standardInputDecoration(
- "Enter inscription number...",
- keywordTextFieldFocusNode,
- context,
- desktopMed: isDesktop,
- ).copyWith(
- contentPadding:
- isDesktop
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(context).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textDark,
+ height: 1.8,
+ )
+ : STextStyles.field(context),
+ decoration:
+ standardInputDecoration(
+ "Enter inscription number...",
+ keywordTextFieldFocusNode,
+ context,
+ desktopMed: isDesktop,
+ ).copyWith(
+ contentPadding: isDesktop
? const EdgeInsets.symmetric(
- vertical: 10,
- horizontal: 16,
- )
+ vertical: 10,
+ horizontal: 16,
+ )
: null,
- suffixIcon:
- _inscriptionTextEditingController.text.isNotEmpty
+ suffixIcon:
+ _inscriptionTextEditingController.text.isNotEmpty
? Padding(
- padding: const EdgeInsets.only(right: 0),
- child: UnconstrainedBox(
- child: Row(
- children: [
- TextFieldIconButton(
- child: const XIcon(),
- onTap: () async {
- setState(() {
- _inscriptionTextEditingController.text =
- "";
- });
- },
- ),
- ],
+ padding: const EdgeInsets.only(right: 0),
+ child: UnconstrainedBox(
+ child: Row(
+ children: [
+ TextFieldIconButton(
+ child: const XIcon(),
+ onTap: () async {
+ setState(() {
+ _inscriptionTextEditingController.text =
+ "";
+ });
+ },
+ ),
+ ],
+ ),
),
- ),
- )
+ )
: null,
- ),
+ ),
),
),
),
@@ -663,10 +648,9 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
child: FittedBox(
child: Text(
"Keyword",
- style:
- isDesktop
- ? STextStyles.labelExtraExtraSmall(context)
- : STextStyles.smallMed12(context),
+ style: isDesktop
+ ? STextStyles.labelExtraExtraSmall(context)
+ : STextStyles.smallMed12(context),
),
),
),
@@ -683,51 +667,48 @@ class _OrdinalsFilterViewState extends ConsumerState<OrdinalsFilterView> {
key: const Key("OrdinalsViewKeywordFieldKey"),
controller: _keywordTextEditingController,
focusNode: keywordTextFieldFocusNode,
- style:
- isDesktop
- ? STextStyles.desktopTextExtraSmall(context).copyWith(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textDark,
- height: 1.8,
- )
- : STextStyles.field(context),
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(context).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textDark,
+ height: 1.8,
+ )
+ : STextStyles.field(context),
onChanged: (_) => setState(() {}),
- decoration: standardInputDecoration(
- "Type keyword...",
- keywordTextFieldFocusNode,
- context,
- desktopMed: isDesktop,
- ).copyWith(
- contentPadding:
- isDesktop
+ decoration:
+ standardInputDecoration(
+ "Type keyword...",
+ keywordTextFieldFocusNode,
+ context,
+ desktopMed: isDesktop,
+ ).copyWith(
+ contentPadding: isDesktop
? const EdgeInsets.symmetric(
- vertical: 10,
- horizontal: 16,
- )
+ vertical: 10,
+ horizontal: 16,
+ )
: null,
- suffixIcon:
- _keywordTextEditingController.text.isNotEmpty
+ suffixIcon: _keywordTextEditingController.text.isNotEmpty
? Padding(
- padding: const EdgeInsets.only(right: 0),
- child: UnconstrainedBox(
- child: Row(
- children: [
- TextFieldIconButton(
- child: const XIcon(),
- onTap: () async {
- setState(() {
- _keywordTextEditingController.text = "";
- });
- },
- ),
- ],
+ padding: const EdgeInsets.only(right: 0),
+ child: UnconstrainedBox(
+ child: Row(
+ children: [
+ TextFieldIconButton(
+ child: const XIcon(),
+ onTap: () async {
+ setState(() {
+ _keywordTextEditingController.text = "";
+ });
+ },
+ ),
+ ],
+ ),
),
- ),
- )
+ )
: null,
- ),
+ ),
),
),
),
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 8fa5fd1..a1a0353 100644
--- a/lib/pages/shopinbit/step_4_components/shopinbit_travel_form.dart
+++ b/lib/pages/shopinbit/step_4_components/shopinbit_travel_form.dart
@@ -201,11 +201,12 @@ class _ShopInBitTravelFormState extends ConsumerState<ShopInBitTravelForm> {
VoidCallback onPicked,
) async {
final now = DateTime.now();
- final DateTime? picked = await showSWDatePicker(
+ final DateTime? picked = (await showSWDatePicker(
context,
firstDate: now,
lastDate: now.add(const Duration(days: 3650)),
- );
+ currentDate: _current,
+ ))?.first;
if (picked != null) {
setState(() {
target.text = _formatDate(picked);
diff --git a/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart b/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart
index a337cd8..453d908 100644
--- a/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart
+++ b/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart
@@ -79,19 +79,18 @@ class _TransactionSearchViewState
_selectedFromDate = filterState.from;
_keywordTextEditingController.text = filterState.keyword;
- _fromDateString =
- _selectedFromDate == null
- ? ""
- : Format.formatDate(_selectedFromDate!);
- _toDateString =
- _selectedToDate == null ? "" : Format.formatDate(_selectedToDate!);
-
- final String amount =
- filterState.amount == null
- ? ""
- : ref
- .read(pAmountFormatter(widget.coin))
- .format(filterState.amount!, withUnitName: false);
+ _fromDateString = _selectedFromDate == null
+ ? ""
+ : Format.formatDate(_selectedFromDate!);
+ _toDateString = _selectedToDate == null
+ ? ""
+ : Format.formatDate(_selectedToDate!);
+
+ final String amount = filterState.amount == null
+ ? ""
+ : ref
+ .read(pAmountFormatter(widget.coin))
+ .format(filterState.amount!, withUnitName: false);
_amountTextEditingController.text = amount;
}
@@ -116,10 +115,9 @@ class _TransactionSearchViewState
return Text(
isDateSelected ? "From..." : _fromDateString,
style: STextStyles.fieldLabel(context).copyWith(
- color:
- isDateSelected
- ? Theme.of(context).extension<StackColors>()!.textSubtitle2
- : Theme.of(context).extension<StackColors>()!.accentColorDark,
+ color: isDateSelected
+ ? Theme.of(context).extension<StackColors>()!.textSubtitle2
+ : Theme.of(context).extension<StackColors>()!.accentColorDark,
),
);
}
@@ -129,10 +127,9 @@ class _TransactionSearchViewState
return Text(
isDateSelected ? "To..." : _toDateString,
style: STextStyles.fieldLabel(context).copyWith(
- color:
- isDateSelected
- ? Theme.of(context).extension<StackColors>()!.textSubtitle2
- : Theme.of(context).extension<StackColors>()!.accentColorDark,
+ color: isDateSelected
+ ? Theme.of(context).extension<StackColors>()!.textSubtitle2
+ : Theme.of(context).extension<StackColors>()!.accentColorDark,
),
);
}
@@ -145,14 +142,13 @@ class _TransactionSearchViewState
const middleSeparatorWidth = 12.0;
final isDesktop = Util.isDesktop;
- final width =
- isDesktop
- ? null
- : (MediaQuery.of(context).size.width -
- (middleSeparatorWidth +
- (2 * middleSeparatorPadding) +
- (2 * Constants.size.standardPadding))) /
- 2;
+ final width = isDesktop
+ ? null
+ : (MediaQuery.of(context).size.width -
+ (middleSeparatorWidth +
+ (2 * middleSeparatorPadding) +
+ (2 * Constants.size.standardPadding))) /
+ 2;
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -168,7 +164,7 @@ class _TransactionSearchViewState
}
if (mounted) {
- final date = await showSWDatePicker(context);
+ final date = (await showSWDatePicker(context))?.first;
if (date != null) {
_selectedFromDate = date;
@@ -184,15 +180,13 @@ class _TransactionSearchViewState
setState(() {
if (flag) {
- _toDateString =
- _selectedToDate == null
- ? ""
- : Format.formatDate(_selectedToDate!);
+ _toDateString = _selectedToDate == null
+ ? ""
+ : Format.formatDate(_selectedToDate!);
}
- _fromDateString =
- _selectedFromDate == null
- ? ""
- : Format.formatDate(_selectedFromDate!);
+ _fromDateString = _selectedFromDate == null
+ ? ""
+ : Format.formatDate(_selectedFromDate!);
});
}
}
@@ -200,18 +194,16 @@ class _TransactionSearchViewState
child: Container(
width: width,
decoration: BoxDecoration(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textFieldDefaultBG,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
border: Border.all(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textFieldDefaultBG,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
width: 1,
),
),
@@ -226,10 +218,9 @@ class _TransactionSearchViewState
Assets.svg.calendar,
height: 20,
width: 20,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textSubtitle2,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textSubtitle2,
),
const SizedBox(width: 10),
Align(
@@ -263,7 +254,7 @@ class _TransactionSearchViewState
}
if (mounted) {
- final date = await showSWDatePicker(context);
+ final date = (await showSWDatePicker(context))?.first;
if (date != null) {
_selectedToDate = date;
@@ -279,15 +270,13 @@ class _TransactionSearchViewState
setState(() {
if (flag) {
- _fromDateString =
- _selectedFromDate == null
- ? ""
- : Format.formatDate(_selectedFromDate!);
+ _fromDateString = _selectedFromDate == null
+ ? ""
+ : Format.formatDate(_selectedFromDate!);
}
- _toDateString =
- _selectedToDate == null
- ? ""
- : Format.formatDate(_selectedToDate!);
+ _toDateString = _selectedToDate == null
+ ? ""
+ : Format.formatDate(_selectedToDate!);
});
}
}
@@ -295,18 +284,16 @@ class _TransactionSearchViewState
child: Container(
width: width,
decoration: BoxDecoration(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textFieldDefaultBG,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
border: Border.all(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textFieldDefaultBG,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
width: 1,
),
),
@@ -321,10 +308,9 @@ class _TransactionSearchViewState
Assets.svg.calendar,
height: 20,
width: 20,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textSubtitle2,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textSubtitle2,
),
const SizedBox(width: 10),
Align(
@@ -356,11 +342,13 @@ class _TransactionSearchViewState
} else {
return Background(
child: Scaffold(
- backgroundColor:
- Theme.of(context).extension<StackColors>()!.background,
+ backgroundColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
appBar: AppBar(
- backgroundColor:
- Theme.of(context).extension<StackColors>()!.background,
+ backgroundColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
leading: AppBarBackButton(
onPressed: () async {
if (FocusScope.of(context).hasFocus) {
@@ -472,14 +460,9 @@ class _TransactionSearchViewState
children: [
Text(
"Sent",
- style:
- isDesktop
- ? STextStyles.desktopTextSmall(
- context,
- )
- : STextStyles.itemSubtitle12(
- context,
- ),
+ style: isDesktop
+ ? STextStyles.desktopTextSmall(context)
+ : STextStyles.itemSubtitle12(context),
),
if (isDesktop) const SizedBox(height: 4),
],
@@ -530,14 +513,9 @@ class _TransactionSearchViewState
children: [
Text(
"Received",
- style:
- isDesktop
- ? STextStyles.desktopTextSmall(
- context,
- )
- : STextStyles.itemSubtitle12(
- context,
- ),
+ style: isDesktop
+ ? STextStyles.desktopTextSmall(context)
+ : STextStyles.itemSubtitle12(context),
),
if (isDesktop) const SizedBox(height: 4),
],
@@ -588,14 +566,9 @@ class _TransactionSearchViewState
children: [
Text(
"Trades",
- style:
- isDesktop
- ? STextStyles.desktopTextSmall(
- context,
- )
- : STextStyles.itemSubtitle12(
- context,
- ),
+ style: isDesktop
+ ? STextStyles.desktopTextSmall(context)
+ : STextStyles.itemSubtitle12(context),
),
if (isDesktop) const SizedBox(height: 4),
],
@@ -617,10 +590,9 @@ class _TransactionSearchViewState
child: FittedBox(
child: Text(
"Date",
- style:
- isDesktop
- ? STextStyles.labelExtraExtraSmall(context)
- : STextStyles.smallMed12(context),
+ style: isDesktop
+ ? STextStyles.labelExtraExtraSmall(context)
+ : STextStyles.smallMed12(context),
),
),
),
@@ -632,10 +604,9 @@ class _TransactionSearchViewState
child: FittedBox(
child: Text(
"Amount",
- style:
- isDesktop
- ? STextStyles.labelExtraExtraSmall(context)
- : STextStyles.smallMed12(context),
+ style: isDesktop
+ ? STextStyles.labelExtraExtraSmall(context)
+ : STextStyles.smallMed12(context),
),
),
),
@@ -653,13 +624,12 @@ class _TransactionSearchViewState
controller: _amountTextEditingController,
focusNode: amountTextFieldFocusNode,
onChanged: (_) => setState(() {}),
- keyboardType:
- Util.isDesktop
- ? null
- : const TextInputType.numberWithOptions(
- signed: false,
- decimal: true,
- ),
+ keyboardType: Util.isDesktop
+ ? null
+ : const TextInputType.numberWithOptions(
+ signed: false,
+ decimal: true,
+ ),
inputFormatters: [
AmountInputFormatter(
decimals: widget.coin.fractionDigits,
@@ -677,50 +647,47 @@ class _TransactionSearchViewState
// ? newValue
// : oldValue),
],
- style:
- isDesktop
- ? STextStyles.desktopTextExtraSmall(context).copyWith(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textDark,
- height: 1.8,
- )
- : STextStyles.field(context),
- decoration: standardInputDecoration(
- "Enter ${widget.coin.ticker} amount...",
- keywordTextFieldFocusNode,
- context,
- desktopMed: isDesktop,
- ).copyWith(
- contentPadding:
- isDesktop
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(context).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textDark,
+ height: 1.8,
+ )
+ : STextStyles.field(context),
+ decoration:
+ standardInputDecoration(
+ "Enter ${widget.coin.ticker} amount...",
+ keywordTextFieldFocusNode,
+ context,
+ desktopMed: isDesktop,
+ ).copyWith(
+ contentPadding: isDesktop
? const EdgeInsets.symmetric(
- vertical: 10,
- horizontal: 16,
- )
+ vertical: 10,
+ horizontal: 16,
+ )
: null,
- suffixIcon:
- _amountTextEditingController.text.isNotEmpty
+ suffixIcon: _amountTextEditingController.text.isNotEmpty
? Padding(
- padding: const EdgeInsets.only(right: 0),
- child: UnconstrainedBox(
- child: Row(
- children: [
- TextFieldIconButton(
- child: const XIcon(),
- onTap: () async {
- setState(() {
- _amountTextEditingController.text = "";
- });
- },
- ),
- ],
+ padding: const EdgeInsets.only(right: 0),
+ child: UnconstrainedBox(
+ child: Row(
+ children: [
+ TextFieldIconButton(
+ child: const XIcon(),
+ onTap: () async {
+ setState(() {
+ _amountTextEditingController.text = "";
+ });
+ },
+ ),
+ ],
+ ),
),
- ),
- )
+ )
: null,
- ),
+ ),
),
),
),
@@ -730,10 +697,9 @@ class _TransactionSearchViewState
child: FittedBox(
child: Text(
"Keyword",
- style:
- isDesktop
- ? STextStyles.labelExtraExtraSmall(context)
- : STextStyles.smallMed12(context),
+ style: isDesktop
+ ? STextStyles.labelExtraExtraSmall(context)
+ : STextStyles.smallMed12(context),
),
),
),
@@ -750,51 +716,48 @@ class _TransactionSearchViewState
key: const Key("transactionSearchViewKeywordFieldKey"),
controller: _keywordTextEditingController,
focusNode: keywordTextFieldFocusNode,
- style:
- isDesktop
- ? STextStyles.desktopTextExtraSmall(context).copyWith(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textDark,
- height: 1.8,
- )
- : STextStyles.field(context),
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall(context).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textDark,
+ height: 1.8,
+ )
+ : STextStyles.field(context),
onChanged: (_) => setState(() {}),
- decoration: standardInputDecoration(
- "Type keyword...",
- keywordTextFieldFocusNode,
- context,
- desktopMed: isDesktop,
- ).copyWith(
- contentPadding:
- isDesktop
+ decoration:
+ standardInputDecoration(
+ "Type keyword...",
+ keywordTextFieldFocusNode,
+ context,
+ desktopMed: isDesktop,
+ ).copyWith(
+ contentPadding: isDesktop
? const EdgeInsets.symmetric(
- vertical: 10,
- horizontal: 16,
- )
+ vertical: 10,
+ horizontal: 16,
+ )
: null,
- suffixIcon:
- _keywordTextEditingController.text.isNotEmpty
+ suffixIcon: _keywordTextEditingController.text.isNotEmpty
? Padding(
- padding: const EdgeInsets.only(right: 0),
- child: UnconstrainedBox(
- child: Row(
- children: [
- TextFieldIconButton(
- child: const XIcon(),
- onTap: () async {
- setState(() {
- _keywordTextEditingController.text = "";
- });
- },
- ),
- ],
+ padding: const EdgeInsets.only(right: 0),
+ child: UnconstrainedBox(
+ child: Row(
+ children: [
+ TextFieldIconButton(
+ child: const XIcon(),
+ onTap: () async {
+ setState(() {
+ _keywordTextEditingController.text = "";
+ });
+ },
+ ),
+ ],
+ ),
),
- ),
- )
+ )
: null,
- ),
+ ),
),
),
),
@@ -887,14 +850,13 @@ class _TransactionSearchViewState
final amountText = _amountTextEditingController.text;
Amount? amount;
if (amountText.isNotEmpty && !(amountText == "," || amountText == ".")) {
- amount =
- amountText.contains(",")
- ? Decimal.parse(
- amountText.replaceFirst(",", "."),
- ).toAmount(fractionDigits: widget.coin.fractionDigits)
- : Decimal.parse(
- amountText,
- ).toAmount(fractionDigits: widget.coin.fractionDigits);
+ amount = amountText.contains(",")
+ ? Decimal.parse(
+ amountText.replaceFirst(",", "."),
+ ).toAmount(fractionDigits: widget.coin.fractionDigits)
+ : Decimal.parse(
+ amountText,
+ ).toAmount(fractionDigits: widget.coin.fractionDigits);
}
final TransactionFilter filter = TransactionFilter(
diff --git a/lib/widgets/date_picker/date_picker.dart b/lib/widgets/date_picker/date_picker.dart
index f258a38..4019b66 100644
--- a/lib/widgets/date_picker/date_picker.dart
+++ b/lib/widgets/date_picker/date_picker.dart
@@ -12,11 +12,12 @@ import '../desktop/secondary_button.dart';
part 'sw_date_picker.dart';
-Future<DateTime?> showSWDatePicker(
+Future<List<DateTime?>?> showSWDatePicker(
BuildContext context, {
DateTime? firstDate,
DateTime? lastDate,
DateTime? currentDate,
+ bool range = false,
}) async {
final Size size;
if (Util.isDesktop) {
@@ -31,7 +32,7 @@ Future<DateTime?> showSWDatePicker(
final now = DateTime.now();
- final date = await _showDatePickerDialog(
+ final dates = await _showDatePickerDialog(
context: context,
value: [now],
dialogSize: size,
@@ -39,6 +40,8 @@ Future<DateTime?> showSWDatePicker(
firstDate: firstDate ?? DateTime(2007),
lastDate: lastDate ?? now,
currentDate: currentDate ?? now,
+ rangeBidirectional: range ? false : null,
+ calendarType: range ? .range : null,
buttonPadding: const EdgeInsets.only(right: 16),
centerAlignModePicker: true,
selectedDayHighlightColor: Theme.of(
@@ -49,7 +52,8 @@ Future<DateTime?> showSWDatePicker(
).extension<StackColors>()!.accentColorDark.withOpacity(0.6),
),
);
- return date?.first;
+
+ return dates;
}
Future<List<DateTime?>?> _showDatePickerDialog({
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.