https://github.com/bynicodevelop/flutter_profile_card
https://github.com/bynicodevelop/flutter_profile_card
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bynicodevelop/flutter_profile_card
- Owner: bynicodevelop
- License: other
- Created: 2020-12-14T18:10:51.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-12-31T14:48:36.000Z (over 5 years ago)
- Last Synced: 2025-10-22T22:16:11.015Z (8 months ago)
- Language: Dart
- Size: 82 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# flutter_profile_card
This plugin allows you to display a user profile with its followers and followings.
Also allows to have a button to follow the user profile.

## Getting Started
```
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter_profile_card/flutter_profile_card.dart';
import 'package:flutter_profile_card/models/Profile.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State {
bool _isFollow = false;
ProfileModel _profileModel;
@override
void initState() {
// Define the model
_profileModel = ProfileModel(
uid: '1234567890',
username: 'John Doe',
status: 'John doe is certainly the best development but very discreet...',
avatarURL: 'https://picsum.photos/200',
followers: 1,
followings: 1234,
);
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
accentColor: Colors.green,
textTheme: TextTheme(
bodyText2: TextStyle(
fontSize: 16.0,
),
),
),
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: ProfileCard(
// Add the model in the widget parameter
profile: _profileModel,
// Capture the follow event
onFollowed: (ProfileModel profile) {
print(profile.toJson());
setState(() {
// Database code...
_isFollow = !_isFollow;
_profileModel.isFollowed = _isFollow;
_profileModel.updateFollowers = _isFollow ? 2 : 1;
});
},
),
),
);
}
}
```