Skip to content

Facing issue with scrolling months. #5

@Aryan2892

Description

@Aryan2892

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions