Flutter个人信息展示插件super_profile_card_package的使用
Flutter个人信息展示插件super_profile_card_package的使用
Super Profile Card Package
介绍一个精心设计的Flutter插件,这个艺术杰作将重新定义你的个人资料页面的优雅与美学。它被精心制作,为你的个人资料卡片注入个性,通过参数如阴影颜色、偏移值和模糊强度来完全且细致地个性化你的个人资料氛围。 🌈
旅程从一个引人注目的圆圈开始,这个圆圈被战略性地放置在个人资料卡片的顶部。周围的专业设计阴影不仅为你的个人资料增加了深度,还赋予了现代感。参数如阴影颜色、偏移值和模糊强度等的灵活性使整体卡片设计可以完全个性化。 🎨💖
可以将此插件视为你的个人资料页面的核心元素;它不仅提供视觉盛宴,还能积极促使用户更深入地参与你的个人资料。如果你正在寻找一个既优雅又细节丰富的个人资料卡片,此插件为你提供了所需的精准工具。它旨在让你的个人资料体验不仅独特,而且留下深刻而持久的印象,确保用户看到你的个人资料时会不由自主地惊叹:“哇!” 🚀✨💯
在这个第一印象至关重要的世界里,这个插件确保你的个人资料成为一个引人入胜且令人难忘的焦点,邀请用户探索并欣赏其中的艺术性。 🌟👁️✨


属性和值
属性 | 值 |
---|---|
gradientColors | List |
iconsColor | Color |
bottomImageUrl | String (URL) |
bottomImageColor | Color |
bottomImageWidth | double |
topImageUrl | String (URL) |
topImageColor | Color |
topImageWidth | double |
logoImageUrl | String (URL) |
logoImageColor | Color |
topText | String |
topTextStyle | TextStyle |
firstIcon, secondIcon, thirdIcon | IconData |
firstIconText, secondIconText, thirdIconText | String |
iconsTextColor | Color |
dividerColor | Color |
shadowColor | Color |
shadowOffset | double |
topCircleColor | Color |
bulurSigmaValue | double |
属性和描述
属性 | 描述 |
---|---|
gradientColors | 用于背景的渐变色列表。 |
iconsColor | 主要图标颜色。 |
bottomImageUrl | 底部部分使用的图像URL。 |
bottomImageColor | 底部图像的背景颜色。 |
bottomImageWidth | 底部图像的宽度。 |
topImageUrl | 顶部部分使用的图像URL。 |
topImageColor | 顶部图像的背景颜色。 |
topImageWidth | 顶部图像的宽度。 |
logoImageUrl | Logo图像的URL。 |
logoImageColor | Logo图像的背景颜色。 |
topText | 顶部显示的文字。 |
topTextStyle | 用于顶部文字的文本样式。 |
firstIcon, secondIcon, thirdIcon | 第一、第二、第三图标。 |
firstIconText, secondIconText, thirdIconText | 第一、第二、第三图标的文字。 |
iconsTextColor | 图标文字颜色。 |
dividerColor | 分割线的颜色。 |
shadowColor | 阴影的颜色。 |
shadowOffset | 阴影的偏移值。 |
topCircleColor | 顶部圆圈的颜色。 |
bulurSigmaValue | 模糊的sigma值。 |
版本
版本 | Flutter | Dart |
---|---|---|
3.15.0 | 3.1.0 |
支持
平台 | 版本 |
---|---|
Android | SDK 16+ |
iOS | 11.0+ |
Web | Any* |
构造函数
final List<Color> gradientColors;
final Color iconsColor;
final String bottomImageUrl;
final Color bottomImageColor;
final double bottomImageWidth;
final String topImageUrl;
final Color topImageColor;
final double topImageWidth;
final String logoImageUrl;
final Color logoImageColor;
final String topText;
final TextStyle topTextStyle;
final IconData firstIcon;
final IconData secondIcon;
final IconData thirdIcon;
final String firstIconText;
final String secondIconText;
final String thirdIconText;
final Color iconsTextColor;
final Color dividerColor;
final Color shadowColor;
final double shadowOffset;
final Color topCircleColor;
final double bulurSigmaValue;
示例
import 'package:flutter/material.dart';
import 'package:super_profile_card_package/profile_card.dart';
class HomeView extends StatelessWidget {
const HomeView({super.key});
[@override](/user/override)
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color.fromARGB(255, 57, 57, 57),
appBar: AppBar(
centerTitle: true,
backgroundColor: const Color.fromARGB(255, 41, 204, 232),
title: const Text(
"Super Profile Card",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
),
body: const SuperProfileCard(
// 卡片背景颜色
gradientColors: [
Color.fromARGB(255, 41, 204, 232),
Color.fromARGB(255, 41, 204, 232),
Color.fromARGB(255, 41, 204, 232),
Color.fromARGB(255, 0, 0, 0),
Color.fromARGB(255, 41, 204, 232),
],
// 图标颜色
// 顶部圆圈颜色
topCircleColor: Color.fromARGB(255, 1, 1, 1),
shadowColor: Colors.black,
shadowOffset: 38.0,
bulurSigmaValue: 10.0,
// 顶部图像
topImageUrl:
'https://github.com/NurhayatYurtaslan/super_profile_card/blob/main/assets/image/png/nine.png?raw=true',
topImageColor: Color.fromARGB(255, 41, 204, 232),
topImageWidth: 1.2,
// Logo 图像
logoImageUrl:
'https://github.com/NurhayatYurtaslan/super_profile_card/blob/main/assets/image/png/logo.png?raw=true',
logoImageColor: Color.fromARGB(255, 41, 204, 232),
// 顶部文字
topText: 'Super Profile Card',
topTextStyle: TextStyle(
color: Color.fromARGB(255, 41, 204, 232),
fontSize: 25,
fontWeight: FontWeight.bold,
),
// 底部图像
bottomImageUrl:
'https://github.com/NurhayatYurtaslan/super_profile_card/blob/main/assets/image/png/ten.png?raw=true',
bottomImageColor: Colors.black,
bottomImageWidth: 0.80,
// 图标
iconsColor: Colors.black,
firstIcon: Icons.link,
secondIcon: Icons.email,
thirdIcon: Icons.location_on,
iconsTextColor: Colors.black,
firstIconText: "First Icon's Text",
secondIconText: "Second Icon's Text",
thirdIconText: "Third Icon's Text",
dividerColor: Colors.black,
),
);
}
}
更多关于Flutter个人信息展示插件super_profile_card_package的使用的实战教程也可以访问 https://www.itying.com/category-92-b0.html
更多关于Flutter个人信息展示插件super_profile_card_package的使用的实战系列教程也可以访问 https://www.itying.com/category-92-b0.html
当然,以下是如何在Flutter项目中使用super_profile_card_package
插件来展示个人信息的代码示例。假设你已经将super_profile_card_package
添加到了你的pubspec.yaml
文件中,并且已经运行了flutter pub get
来安装依赖。
1. 添加依赖
首先,确保你的pubspec.yaml
文件中包含以下依赖:
dependencies:
flutter:
sdk: flutter
super_profile_card_package: ^最新版本号 # 请替换为实际的最新版本号
2. 导入包
在你的Dart文件中(例如main.dart
),导入super_profile_card_package
:
import 'package:flutter/material.dart';
import 'package:super_profile_card_package/super_profile_card_package.dart';
3. 使用SuperProfileCard组件
接下来,你可以在你的应用中创建一个SuperProfileCard
组件来展示个人信息。下面是一个完整的示例:
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: ProfilePage(),
);
}
}
class ProfilePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('个人信息展示'),
),
body: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: SuperProfileCard(
profileImage: NetworkImage('https://example.com/profile.jpg'), // 替换为你的图片URL
name: '张三',
title: '软件工程师',
location: '北京',
bio: '热爱编程,专注于Flutter开发。',
socialMediaIcons: [
SocialMediaIcon(
iconData: Icons.email,
url: 'mailto:zhangsan@example.com',
),
SocialMediaIcon(
iconData: Icons.phone,
url: 'tel:+1234567890',
),
SocialMediaIcon(
iconData: Icons.linkedin,
url: 'https://www.linkedin.com/in/zhangsan',
),
],
),
),
),
);
}
}
4. 自定义SocialMediaIcon(如果需要)
如果super_profile_card_package
提供了自定义SocialMediaIcon
的方式,你可能需要按照包的文档来定义。如果包没有提供直接的自定义方式,但你需要额外的功能,可以考虑扩展或封装该组件。以下是一个假设的扩展示例:
class CustomSocialMediaIcon extends StatelessWidget {
final IconData iconData;
final String url;
CustomSocialMediaIcon({required this.iconData, required this.url});
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () => launchUrl(Uri.parse(url)), // 使用url_launcher包来打开链接
child: Icon(iconData),
);
}
}
请注意,上面的launchUrl
函数来自url_launcher
包,你可能需要添加该依赖到你的pubspec.yaml
中并导入它:
dependencies:
url_launcher: ^最新版本号 # 请替换为实际的最新版本号
然后在你的Dart文件中导入:
import 'package:url_launcher/url_launcher.dart';
总结
以上代码展示了如何在Flutter应用中使用super_profile_card_package
插件来展示个人信息。根据你的具体需求和super_profile_card_package
的实际API,你可能需要调整或扩展上述代码。务必参考插件的官方文档以获取最新的使用指南和API参考。