Flutter扩展悬浮动画插件expanded_hover_animation的使用
Flutter扩展悬浮动画插件expanded_hover_animation的使用
该插件是一个可定制的扩展悬浮动画包,适用于Flutter。它是一个简单易用的插件,可以让你为任何组件添加一个可扩展的悬浮动画。你可以自定义动画持续时间、曲线、大小、边框、圆角半径、主颜色和悬停颜色。
快速演示
视频演示
使用Expanded Hover Animation
SizedBox(
height: 250,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: testImages.length,
itemBuilder: (context, index) {
return HoverCard(
image: testImages[index],
isAssetImage: false,
);
},
),
),
探索更多属性
HoverCard(
image: testImages[index],
isAssetImage: false,
primaryColor: Colors.blue,
hoverColor: Colors.red,
size: 200,
borderRadius: 20,
border: 5,
duration: 500,
curve: Curves.easeInOut,
);
需要帮助?
如果你在设置项目时遇到问题或有任何疑问,请随时通过以下方式联系我:
- Twitter: https://twitter.com/tusharhow
- LinkedIn: https://www.linkedin.com/in/tusharhow/
社交媒体
许可证
Copyright (c) 2023 Tushar Mahmud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
完整示例代码
import 'package:expanded_hover_animation/expanded_hover_animation.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
[@override](/user/override)
Widget build(BuildContext context) {
return MaterialApp(
title: 'Extended Hover Animation',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({Key? key}) : super(key: key);
[@override](/user/override)
Widget build(BuildContext context) {
// 测试用的图片列表
List<String> testImages = [
'https://m.media-amazon.com/images/M/MV5BNDU0MjViZmQtNzdmZS00YjhlLWE4ZGMtMDJlODAzMGI5ODIwXkEyXkFqcGdeQXVyNDI3NjcxMDA@._V1_.jpg',
'https://m.media-amazon.com/images/M/MV5BY2Y5MThlMDAtMTlmMC00ODNjLWIzM2UtNDhlZTFmN2VlNjRkXkEyXkFqcGdeQXVyNjA3OTI5MjA@._V1_.jpg',
'https://m.media-amazon.com/images/M/MV5BNTM0YmJmMGMtMmYyMC00YTU3LWEzNjQtODU4NjQ3YjY3NTU1XkEyXkFqcGdeQXVyNDI3NjcxMDA@._V1_.jpg',
'https://m.media-amazon.com/images/M/MV5BODQ1Y2FiNzItNjdkZi00ZmRiLTllZjgtZjA2MTIyNWFjOGZhXkEyXkFqcGdeQXVyOTE1NzI0NDg@._V1_FMjpg_UX1000_.jpg',
'https://m.media-amazon.com/images/M/MV5BYmRhZDJmN2QtYjU4NC00Y2QxLTkwNWMtYzVlODU5YzcyZjA2XkEyXkFqcGdeQXVyMTMzOTM3NDUx._V1_FMjpg_UX1000_.jpg',
'https://m.media-amazon.com/images/M/MV5BNjRhOTQ4ZGEtNDBkOS00N2E5LWJlMDUtM2MxZDg5MGVhOWE5XkEyXkFqcGdeQXVyOTQ0MDUwOTM@._V1_.jpg',
];
return Scaffold(
body: SizedBox(
height: 250,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: testImages.length,
itemBuilder: (context, index) {
return HoverCard(
image: testImages[index],
isAssetImage: false,
);
},
),
),
);
}
}
更多关于Flutter扩展悬浮动画插件expanded_hover_animation的使用的实战教程也可以访问 https://www.itying.com/category-92-b0.html
1 回复