Transform_defaultCommonTransform(Widget item,
double fraction, double curveFraction, double cardHeight, double cardWidth, int fromPosition, int toPosition)
{
//Count of card which needs to move overint positionCount = fromPosition - toPosition;
//0.8 scale for the first card, and -0.1 per card behind//(0.8 - 0.1 * fromPosition) = current specific card scale//(0.1 * fraction * positionCount) = scale while movingdouble scale = (0.8 - 0.1 * fromPosition) + (0.1 * fraction * positionCount);
//translate -0.02 * cardHeight per card behind//-cardHeight * (0.8 - scale) * 0.5 to center the carddouble translationY = -cardHeight * (0.8 - scale) * 0.5 -
cardHeight * (0.02 * fromPosition - 0.02 * fraction * positionCount);
//return the Widget after scale and translatereturnTransform.translate(
offset: Offset(0, translationY),
child: Transform.scale(
scale: scale,
child: item,
),
);
}
License
InfiniteCards is released under the Apache 2.0 license.
Copyright2019BakerJ.
Licensed under the ApacheLicense, Version2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at following link.
http://www.apache.org/licenses/LICENSE-2.0Unlessrequired by applicable law or agreed to in writing, software
distributed under the Licenseis distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the Licensefor the specific language governing permissions and
limitations under the License.