Skip to content

Commit

Permalink
Merge pull request X-Wei#65 from Alabhya268/DateRange
Browse files Browse the repository at this point in the history
Added DateRange Picker Demo
  • Loading branch information
X-Wei authored Nov 28, 2020
2 parents 8c5a7b3 + 1799051 commit 17b5151
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/routes/nav_dialogs_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,29 @@ class DialogsExample extends StatelessWidget {
},
child: const Text('Date Picker Dialog'),
),
////// DateRange Picker Dialog.
RaisedButton(
color: Colors.purple,
onPressed: () {
showDateRangePicker(
context: context,
firstDate: DateTime(2018),
lastDate: DateTime(2025),
).then((DateTimeRange value) {
if (value != null) {
DateTimeRange _fromRange =
DateTimeRange(start: DateTime.now(), end: DateTime.now());
_fromRange = value;
final String range =
'${DateFormat.yMMMd().format(_fromRange.start)} - ${DateFormat.yMMMd().format(_fromRange.end)}';
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(range)),
);
}
});
},
child: const Text('Date Range Picker Dialog'),
),
////// Bottom Sheet Dialog.
RaisedButton(
color: Colors.orange,
Expand Down

0 comments on commit 17b5151

Please sign in to comment.