Welcome to the my_profile_avatar project! This customizable Flutter package helps you display profile avatars with ease. You can use network images, local files, initials, or even placeholders. Follow the steps below to set up this package.
You can download the latest version of my_profile_avatar from our Releases page. Simply visit this page to download:
To use my_profile_avatar, ensure you have the following:
- Flutter SDK: Version 2.0 or higher
- Dart SDK: Version 2.12 or higher
- Compatible Devices: iOS and Android platforms
-
Download the Package Visit the Releases Page to obtain the latest version. Click on the package file that suits your development environment.
-
Add to Your Project Unzip the downloaded package. Move the
my_profile_avatarfolder into your Flutter projectβslibdirectory. -
Update pubspec.yaml Open your
pubspec.yamlfile and add the following line:dependencies: my_profile_avatar: path: ./lib/my_profile_avatar
-
Install Dependencies Run the following command in your terminal:
flutter pub get
-
Import the Package In your Dart files where you want to use the avatar, add this import statement:
import 'package:my_profile_avatar/my_profile_avatar.dart';
Here is a simple example of how to use the my_profile_avatar package in your Flutter app:
import 'package:flutter/material.dart';
import 'package:my_profile_avatar/my_profile_avatar.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Profile Avatar Example')),
body: Center(
child: ProfileAvatar(
imageUrl: 'https://example.com/profile.jpg', // Use your image URL
initials: 'AB', // Optionally provide initials
size: 100, // Set the desired size
placeholderIcon: Icons.person_outline, // Placeholder icon
),
),
),
);
}
}This example shows a simple Flutter app displaying a profile avatar. You can customize the avatar by changing the imageUrl, initials, size, and placeholderIcon properties.
- Network Images: Load avatars directly from URLs.
- Local Files: Display images stored on your device.
- Initials Support: Show user initials when no image is available.
- Placeholder Icons: Use predefined icons while images load.
If you encounter issues while installing or running the app, consider the following:
-
Ensure you are using the latest version of Flutter and Dart.
-
Check that the path in your
pubspec.yamlis correct. -
Look for typos in your import statements.
-
Clear the Flutter cache with the following:
flutter clean
Join our community for discussions, updates, and support.
- GitHub Issues: If you face bugs or have feature requests, feel free to create an issue on our GitHub Repo.
- Discussion Forum: Share your experience and learn from others in our online forum.
- Flutter Documentation: Flutter Official Docs
- Dart Documentation: Dart Official Docs
Explore the various ways to enhance your profile picture experience with the my_profile_avatar package. Have fun customizing!