Skip to content

Fused Date Picker - #29

Draft
sarbagyastha wants to merge 4 commits into
mainfrom
fused
Draft

Fused Date Picker#29
sarbagyastha wants to merge 4 commits into
mainfrom
fused

Conversation

@sarbagyastha

@sarbagyastha sarbagyastha commented Sep 23, 2024

Copy link
Copy Markdown
Owner

For testing out the fused date picker:

nepali_date_picker:
  git:
    url: https://github.com/sarbagyastha/nepali_date_picker.git
    ref: fused

@sarbagyastha
sarbagyastha marked this pull request as draft September 23, 2024 06:22
@sarbagyastha
sarbagyastha requested a review from Copilot July 1, 2025 14:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a “fused” date picker that lets users switch between Gregorian and Nepali calendars, renames the internal date-picker dialog class to a public API with a selection callback, and updates the example app accordingly.

  • Publicly exposes NepaliDatePickerDialog (formerly _DatePickerDialog) and adds an onDateChanged callback.
  • Adds FusedDatePickerDialog with an AD/BS toggle and integrates it into the example app’s UI.
  • Bumps the example’s SDK constraint and refactors example project boilerplate (AppDelegates, buttons, main app structure).

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/src/material/date_picker.dart Renamed _DatePickerDialogNepaliDatePickerDialog, added onDateChanged and initialEntryMode fields
lib/src/fused_date_picker_dialog.dart New FusedDatePickerDialog with AD/BS toggle and switch-based builder
lib/nepali_date_picker.dart Exported the new fused dialog
example/pubspec.yaml Updated Dart SDK lower bound to >=3.5.0 <4.0.0
example/macos/Runner/AppDelegate.swift Replaced @NSApplicationMain with @main
example/ios/Runner/AppDelegate.swift Replaced @UIApplicationMain with @main
example/lib/modes/date_range_picker_widget.dart Removed custom styling from example buttons
example/lib/modes/date_picker_widget.dart Removed custom styling from example buttons
example/lib/modes/calendar_date_picker_widget.dart Simplified sizing and text styles in TodayWidget
example/lib/main.dart Refactored app entry into HomePage, added fused date-picker tab
Comments suppressed due to low confidence (2)

lib/src/fused_date_picker_dialog.dart:1

  • There are no unit or widget tests covering the new FusedDatePickerDialog. Adding tests for mode toggling, date selection, and dialog result will help prevent regressions.
import 'package:flutter/material.dart';

lib/src/material/date_picker.dart:216

  • The new initialEntryMode field is never initialized in the constructor. Add a constructor parameter or provide a default value to avoid a compilation error.
  final DatePickerEntryMode initialEntryMode;

Comment thread example/lib/main.dart
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 5,

Copilot AI Jul 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DefaultTabController length (5) does not match the number of tabs and views (4), which will trigger an assertion failure. Please update the length to match.

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +55
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_AdBsToggle(
onChanged: (mode) {
_mode = mode;
setState(() {});
},
),
switch (_mode) {
CalendarMode.ad => DatePickerDialog(
firstDate: widget.firstDate,
lastDate: widget.lastDate,
currentDate: _selectedDate,
),
CalendarMode.bs => NepaliDatePickerDialog(
initialDate: NepaliDateTime.now(),
firstDate: widget.firstDate.toNepaliDateTime(),
lastDate: widget.lastDate.toNepaliDateTime(),
onDateChanged: (date) {
_selectedDate = date.toDateTime();
},
),
}
],

Copilot AI Jul 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The toggle control is rendered outside of a dialog container. Consider wrapping the toggle and picker widgets in a Dialog or AlertDialog so the entire UI appears as a single modal dialog.

Suggested change
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_AdBsToggle(
onChanged: (mode) {
_mode = mode;
setState(() {});
},
),
switch (_mode) {
CalendarMode.ad => DatePickerDialog(
firstDate: widget.firstDate,
lastDate: widget.lastDate,
currentDate: _selectedDate,
),
CalendarMode.bs => NepaliDatePickerDialog(
initialDate: NepaliDateTime.now(),
firstDate: widget.firstDate.toNepaliDateTime(),
lastDate: widget.lastDate.toNepaliDateTime(),
onDateChanged: (date) {
_selectedDate = date.toDateTime();
},
),
}
],
return AlertDialog(
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
_AdBsToggle(
onChanged: (mode) {
_mode = mode;
setState(() {});
},
),
switch (_mode) {
CalendarMode.ad => DatePickerDialog(
firstDate: widget.firstDate,
lastDate: widget.lastDate,
currentDate: _selectedDate,
),
CalendarMode.bs => NepaliDatePickerDialog(
initialDate: NepaliDateTime.now(),
firstDate: widget.firstDate.toNepaliDateTime(),
lastDate: widget.lastDate.toNepaliDateTime(),
onDateChanged: (date) {
_selectedDate = date.toDateTime();
},
),
}
],
),

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants