Fingertips18 / scroll-wheel-date-picker

A Flutter package for a scrollable and flat perspective wheel-type date picker like in TikTok.
https://pub.dev/packages/scroll_wheel_date_picker
MIT License
4 stars 4 forks source link

Facing issue with scrolling months. #5

Open Aryan2892 opened 3 months ago

Aryan2892 commented 3 months ago

I am facing issue when I scroll the months tab in the date picker. Also the months are not being shown as three letters. Months are being shown as full length.

  final DateTime currentDate = DateTime.now();
  final DateTime firstDate = DateTime(1990, 1, 1);

  DateTime? _selectedDate;
ScrollWheelDatePicker(
  initialDate: DateTime(1995, 1, 1),
  startDate: firstDate,
  lastDate: currentDate,
  theme: CurveDatePickerTheme(
    wheelPickerHeight: 200.0,
    overlay: ScrollWheelDatePickerOverlay.highlight,
    itemTextStyle: GoogleFonts.urbanist(
      color: Theme.of(context).colorScheme.secondary,
      fontSize: 30,
      fontWeight: FontWeight.w800,
    ),
    monthFormat: MonthFormat.threeLetters,
    overlayColor: Theme.of(context).colorScheme.primary,
    overAndUnderCenterOpacity: 0.2,
  ),
  onSelectedItemChanged: (value) {
    Logger().d('Selected date: $value');
    setState(() {
      _selectedDate = value;
    });
  },
),

CustomButton(
                onPressed: () {
                  if (_selectedDate != null) {
                    final formattedDate =
                        DateFormat('yyyy-MM-dd').format(_selectedDate!);
                    pickBirthday(formattedDate.toString());
                  }
                },
                buttonText: tr('continue'),
                assetPath: 'assets/img/arrow.png',
              ),

This is the what is shown in debug

     final List<DiagnosticsNode> information = <DiagnosticsNode>[
          ErrorSummary('setState() or markNeedsBuild() called during build.'),
          ErrorDescription(
            'This ${widget.runtimeType} widget cannot be marked as needing to build because the framework '
            'is already in the process of building widgets. A widget can be marked as '
            'needing to be built during the build phase only if one of its ancestors '
            'is currently building. This exception is allowed because the framework '
            'builds parent widgets before children, which means a dirty descendant '
            'will always be built. Otherwise, the framework might not visit this '
            'widget during this build phase.',
          ),
          describeElement('The widget on which setState() or markNeedsBuild() was called was'),
        ];
        if (owner!._debugCurrentBuildTarget != null) {
          information.add(owner!._debugCurrentBuildTarget!.describeWidget('The widget which was currently being built when the offending call was made was'));
        }
        throw FlutterError.fromParts(information);
      } 

Please let me know if there is any initialization error or if there is any error with the way I am coding.

kunit1 commented 4 weeks ago

I have the same exact issue. @Fingertips18 Would you be able to help?