at_follows_flutter
Introduction
A Flutter plugin that provides a basic social "follows" functionality for @signs. This plugin provides a list of followers and following for @signs with the option to unfollow them.
Features
In addition to providing the list of followers and following, this plugin:
- Provides services to follow and unfollow.
- Remove contact from followers list, manage list of followers, and list of following.
Get Started
To get a basic overview of the @protocol and it's packages. Please visit the atsign docs.
To use this package you must be have a basic setup of the @platform/at_app. Go here to get started.
Android
Add the following permissions to AndroidManifest.xml:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.camera.flash" />
Also, update the Android version support in app/build.gradle:
compileSdkVersion 29 // And above
minSdkVersion 24
targetSdkVersion 29 // And above
iOS
Add the following permission string to info.plist:
<key>NSCameraUsageDescription</key>
<string>The camera is used to scan QR code to pair your device with your @sign</string>
Also, update the Podfile with the following lines of code:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.calendar
'PERMISSION_EVENTS=0',
## dart: PermissionGroup.reminders
'PERMISSION_REMINDERS=0',
## dart: PermissionGroup.contacts
'PERMISSION_CONTACTS=0',
## dart: PermissionGroup.microphone
'PERMISSION_MICROPHONE=0',
## dart: PermissionGroup.speech
'PERMISSION_SPEECH_RECOGNIZER=0',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=0',
## dart: PermissionGroup.notification
'PERMISSION_NOTIFICATIONS=0',
## dart: PermissionGroup.sensors
'PERMISSION_SENSORS=0'
]
end
end
end
Plugin description
Supports for single @sign follows feature. This plugin provides two screens:
-
Follows screen - Displays all the @signs that are being followed and followers of the given @sign. Unfollow button will remove the particular @sign from following whereas follow button adds the @sign to following list.
-
Add @sign to follow - Scan the QR code of an @sign or type the @sign to follow.
Sample usage
The plugin takes AtClientService instance to show the follows list of an @sign.
TextButton(
color: Colors.black,
onPressed: () {
Navigator.push(
ctxt,
MaterialPageRoute(
builder: (context) => Connections(
atClientserviceInstance: atClientServiceInstance,
appColor: Colors.blue)));
},
child: Text('AtFollows')
)
Plugin parameters
atClientserviceInstance
- to perform further actions for the given @sign.appColor
- applies to plugin screens to match the app's theme. (This should be bright color as it takes white font over that. Defaults to orange).followerAtsignTitle
- follower @sign received from app's notificationfollowAtsignTitle
- @sign followed from webapp.
Follow an @sign
To follow an @sign, call the following method:
/// Get the AtFollowServices instance
AtFollowServices atFollowServices = AtFollowServices();
Future<bool> followAtSign(String atSign)async {
/// ... YOUR CODE ... ///
/// Call the follow() method to follow an @sign
bool isFollowed = await atFollowServices.follow(atSign);
return isFollowed;
}
Unfollow an @sign
To unfollow an @sign, call the following method and pass the @sign to unfollow:
Future<bool> unfollowAtSign(String atSign)async {
/// ... YOUR CODE ... ///
/// Call the unfollow() method to unfollow an @sign
bool isUnfollowed = await atFollowServices.unfollow(atSign);
return isUnfollowed;
}
Remove a @sign from following list
To remove an @sign from following list, call the following method and pass the @sign to remove:
Future<bool> removeFollower(String atSign)async {
/// ... YOUR CODE ... ///
/// Call the removeFollower() method to remove an @sign from following list
bool isRemoved = await atFollowServices.removeFollower(atSign);
return isRemoved;
}
Get the list of followers
To get the list of followers, call the following method:
Future<AtFollowsList?> getFollowers()async {
/// ... YOUR CODE ... ///
/// Call the getFollowersList() method to get the list of followers
AtFollowsList? followers = await atFollowServices.getFollowersList();
return followers;
}
Get the list of following
To get the list of following, call the following method:
Future<AtFollowsList?> getFollowings()async {
/// ... YOUR CODE ... ///
/// Call the getFollowingList() method to get the list of following
AtFollowsList? following = await atFollowServices.getFollowingList();
return following;
}
Libraries
- app_constants
- at_exception_handler
- at_follow_services
- at_follows_exceptions
- at_follows_flutter
- at_follows_list
- atsign
- color_constants
- connection_model
- connections
- connections_service
- custom_appbar
- custom_textstyles
- error_dialog
- followers
- images
- json
- notification_service
- notifications
- qrscan
- sdk_service
- size_config
- strings
- web_view_screen