Improve route animation.
This commit is contained in:
parent
24861bf588
commit
974c2af18e
|
@ -85,6 +85,7 @@ class _PodcastDetailState extends State<PodcastDetail> {
|
||||||
bool _selectAll;
|
bool _selectAll;
|
||||||
bool _selectBefore;
|
bool _selectBefore;
|
||||||
bool _selectAfter;
|
bool _selectAfter;
|
||||||
|
bool _loadEpisodes = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
@ -97,6 +98,8 @@ class _PodcastDetailState extends State<PodcastDetail> {
|
||||||
_selectAll = false;
|
_selectAll = false;
|
||||||
_selectAfter = false;
|
_selectAfter = false;
|
||||||
_selectBefore = false;
|
_selectBefore = false;
|
||||||
|
Future.delayed(Duration(milliseconds: 200))
|
||||||
|
.then((value) => setState(() => _loadEpisodes = true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -434,57 +437,6 @@ class _PodcastDetailState extends State<PodcastDetail> {
|
||||||
height: 30,
|
height: 30,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
//SizedBox(width: 10),
|
|
||||||
// _customPopupMenu(
|
|
||||||
// tooltip: s.homeSubMenuSortBy,
|
|
||||||
// child: Container(
|
|
||||||
// height: 30,
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// borderRadius: BorderRadius.circular(100.0),
|
|
||||||
// border: Border.all(color: context.primaryColorDark),
|
|
||||||
// ),
|
|
||||||
// padding: EdgeInsets.symmetric(horizontal: 10),
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisSize: MainAxisSize.min,
|
|
||||||
// children: <Widget>[
|
|
||||||
// Text(s.homeSubMenuSortBy),
|
|
||||||
// SizedBox(width: 5),
|
|
||||||
// Icon(
|
|
||||||
// _reverse
|
|
||||||
// ? LineIcons.hourglass_start_solid
|
|
||||||
// : LineIcons.hourglass_end_solid,
|
|
||||||
// size: 18,
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// )),
|
|
||||||
// itemBuilder: [
|
|
||||||
// PopupMenuItem(
|
|
||||||
// value: 0,
|
|
||||||
// child: Row(
|
|
||||||
// children: [
|
|
||||||
// Text(s.newestFirst),
|
|
||||||
// Spacer(),
|
|
||||||
// if (!_reverse) DotIndicator()
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// PopupMenuItem(
|
|
||||||
// value: 1,
|
|
||||||
// child: Row(
|
|
||||||
// children: [
|
|
||||||
// Text(s.oldestFirst),
|
|
||||||
// Spacer(),
|
|
||||||
// if (_reverse) DotIndicator()
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// onSelected: (value) {
|
|
||||||
// if (value == 0) {
|
|
||||||
// setState(() => _reverse = false);
|
|
||||||
// } else if (value == 1) setState(() => _reverse = true);
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
SizedBox(width: 15),
|
SizedBox(width: 15),
|
||||||
_customPopupMenu(
|
_customPopupMenu(
|
||||||
tooltip: s.filter,
|
tooltip: s.filter,
|
||||||
|
@ -858,6 +810,7 @@ class _PodcastDetailState extends State<PodcastDetail> {
|
||||||
child: _multiSelect
|
child: _multiSelect
|
||||||
? Center()
|
? Center()
|
||||||
: _actionBar(context)),
|
: _actionBar(context)),
|
||||||
|
if (_loadEpisodes)
|
||||||
FutureBuilder<List<EpisodeBrief>>(
|
FutureBuilder<List<EpisodeBrief>>(
|
||||||
future: _getRssItem(widget.podcastLocal,
|
future: _getRssItem(widget.podcastLocal,
|
||||||
count: _top,
|
count: _top,
|
||||||
|
|
|
@ -16,15 +16,27 @@ class SlideLeftRoute extends PageRouteBuilder {
|
||||||
animation,
|
animation,
|
||||||
secondaryAnimation,
|
secondaryAnimation,
|
||||||
child,
|
child,
|
||||||
) =>
|
) {
|
||||||
SlideTransition(
|
var begin = Offset(1.0, 0.0);
|
||||||
position: Tween<Offset>(
|
var end = Offset.zero;
|
||||||
begin: const Offset(1, 0),
|
var curve = Curves.easeOutQuart;
|
||||||
end: Offset.zero,
|
var tween =
|
||||||
).animate(animation),
|
Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
|
||||||
child: child,
|
var tweenSequence = TweenSequence(<TweenSequenceItem<Offset>>[
|
||||||
|
TweenSequenceItem<Offset>(
|
||||||
|
tween: tween,
|
||||||
|
weight: 90.0,
|
||||||
),
|
),
|
||||||
|
TweenSequenceItem<Offset>(
|
||||||
|
tween: ConstantTween<Offset>(Offset.zero),
|
||||||
|
weight: 10.0,
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
return SlideTransition(
|
||||||
|
position: animation.drive(tweenSequence),
|
||||||
|
child: child,
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class SlideLeftHideRoute extends PageRouteBuilder {
|
class SlideLeftHideRoute extends PageRouteBuilder {
|
||||||
|
|
Loading…
Reference in New Issue