-
Notifications
You must be signed in to change notification settings - Fork 216
add option for edge fading #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Don't hesitate to criticise my work, it's my first pull request on flutter :) |
@@ -31,15 +33,16 @@ class DatePickerTimeline extends StatefulWidget { | |||
this.daysCount = 50000, | |||
this.onDateChange, | |||
this.locale = "en_US", | |||
this.isEdgeFadding = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New parameter to enable EdgeFadding
Awesome work @QuentinSc, can you try to implement edge fading without using another third-party library? I am a little busy these days so I couldn't review your pull request sooner. |
Padding( | ||
padding: EdgeInsets.all(50), | ||
), | ||
Text("With edge fadding"), | ||
Padding( | ||
padding: EdgeInsets.all(10), | ||
), | ||
DatePickerTimeline( | ||
_selectedValue, | ||
isEdgeFadding: true, | ||
onDateChange: (date) { | ||
// New date selected | ||
setState(() { | ||
_selectedValue = date; | ||
}); | ||
}, | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2nd example, with EdgeFadding
fading_edge_scrollview: | ||
dependency: transitive | ||
description: | ||
name: fading_edge_scrollview | ||
url: "https://pub.dartlang.org" | ||
source: hosted | ||
version: "1.0.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add edgefading package
return DateWidget( | ||
date: date, | ||
monthTextStyle: widget.monthTextStyle, | ||
dateTextStyle: widget.dateTextStyle, | ||
dayTextStyle: widget.dayTextStyle, | ||
locale: widget.locale, | ||
selectionColor: | ||
isSelected ? widget.selectionColor : Colors.transparent, | ||
onDateSelected: (selectedDate) { | ||
// A date is selected | ||
if (widget.onDateChange != null) { | ||
widget.onDateChange(selectedDate); | ||
} | ||
setState(() { | ||
widget.currentDate = selectedDate; | ||
}); | ||
}, | ||
); | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just format code for the DateWidget
Widget buildList(BuildContext context) { | ||
return ListView.builder( | ||
itemCount: widget.daysCount, | ||
scrollDirection: Axis.horizontal, | ||
controller: new ScrollController(), | ||
itemBuilder: (context, index) { | ||
// Return the Date Widget | ||
DateTime _date = DateTime.now().add(Duration(days: index)); | ||
DateTime date = new DateTime(_date.year, _date.month, _date.day); | ||
bool isSelected = compareDate(date, widget.currentDate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create buildList to avoid code diplucation
Thank you. |
208d012
to
955a106
Compare
Hello,
I just discovered the package https://pub.dev/packages/fading_edge_scrollview and I love it.
I propose an option to use it in your fabulous widget.
I tried to implement it without complexify maintenance.
I added it to example.
Thank you