This document provides comprehensive guidelines for developing and contributing to the Flutter Sign-in Button package.
Before you begin, ensure you have the following installed:
- Flutter SDK (latest stable version)
- Dart SDK (>= 2.12.0)
- Android Studio or IntelliJ IDEA (for Android development)
- Xcode (for iOS development, macOS only)
- Git (for version control)
git clone https://github.com/ZaynJarvis/Flutter-Sign-in-Button.git
cd Flutter-Sign-in-Buttonflutter pub getflutter doctorEnsure all checks pass before proceeding.
Flutter-Sign-in-Button/
├── lib/ # Main package source code
│ ├── flutter_signin_button.dart # Main entry point
│ ├── button_builder.dart # Custom button builder
│ ├── button_list.dart # Predefined button types
│ └── button_view.dart # Button view implementation
├── example/ # Example application
│ ├── lib/main.dart # Example app main file
│ └── pubspec.yaml # Example dependencies
├── assets/ # Button logos and assets
│ └── logos/ # Brand logos (1x, 2x, 3x)
├── android/ # Android-specific files
├── ios/ # iOS-specific files
├── pubspec.yaml # Package configuration
├── CHANGELOG.md # Version history
└── README.md # Package documentation
To test your changes, run the example application:
cd example
flutter runDuring development, use hot reload for faster iteration:
- Press
rin the terminal - Or use your IDE's hot reload feature
Run static analysis to ensure code quality:
flutter analyzeFormat your code according to Dart conventions:
dart format .Execute the test suite:
flutter test- Place test files in the
test/directory - Follow the naming convention:
*_test.dart - Write unit tests for new functionality
- Include widget tests for UI components
Example test structure:
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_signin_button/flutter_signin_button.dart';
void main() {
group('SignInButton Tests', () {
testWidgets('renders Google sign-in button', (WidgetTester tester) async {
// Test implementation
});
});
}To add a new social media sign-in button:
Edit lib/button_list.dart:
enum Buttons {
// ... existing buttons
NewSocialMedia,
}In the same file, add configuration:
case Buttons.NewSocialMedia:
return ButtonStyle(
iconColor: Colors.white,
color: Color(0xFF123456), // Brand color
text: "Sign in with NewSocialMedia",
fontSize: 14.0,
);- Add logo files to
assets/logos/(1x, 2x, 3x versions) - Update
pubspec.yamlto include new assets - Use PNG format with transparent backgrounds
- Add the new button to README.md examples
- Update the enum documentation
- Add entry to CHANGELOG.md
- Follow Effective Dart guidelines
- Use meaningful variable and function names
- Add documentation comments for public APIs
- Keep functions small and focused
- Use
constconstructors where possible - Implement proper
keyparameter handling - Follow Flutter widget composition patterns
- Ensure widgets are responsive
class SignInButton extends StatelessWidget {
/// Creates a sign-in button for the specified [Buttons] type.
///
/// The [button] parameter specifies which social media button to render.
/// The [onPressed] callback is required and called when the button is tapped.
const SignInButton(
this.button, {
Key? key,
required this.onPressed,
this.mini = false,
this.text,
this.elevation = 2.0,
}) : super(key: key);
final Buttons button;
final VoidCallback onPressed;
final bool mini;
final String? text;
final double elevation;
@override
Widget build(BuildContext context) {
// Implementation
}
}- Version Bump: Update version in
pubspec.yaml - Changelog: Add entries to
CHANGELOG.md - Documentation: Update README.md if needed
- Testing: Run full test suite
- Analysis: Ensure
flutter analyzepasses - Example: Verify example app works
# Dry run to check package
flutter pub publish --dry-run
# Publish to pub.dev
flutter pub publish- Create a new branch for the release
- Make all necessary updates
- Create a pull request
- After approval, merge to master
- Create a git tag for the version
- Publish to pub.dev
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-button - Commit changes with clear messages
- Test your changes thoroughly
- Submit a pull request with description
Use conventional commit format:
type(scope): description
Examples:
feat(buttons): add Instagram sign-in button
fix(ui): correct button alignment issue
docs(readme): update installation instructions
When reporting issues:
- Use the provided issue templates
- Include Flutter/Dart versions
- Provide minimal reproduction code
- Add screenshots for UI issues
Asset Loading Problems:
- Ensure assets are properly declared in
pubspec.yaml - Check file paths and names
- Rebuild after adding new assets
Button Styling Issues:
- Verify brand color codes
- Check icon sizes and positioning
- Test on different screen densities
Build Errors:
- Run
flutter cleanandflutter pub get - Check Flutter and Dart versions
- Verify all dependencies are compatible
- Check existing GitHub Issues
- Review the README.md documentation
- Look at the example implementation
- Ask questions in the project discussions
Thank you for contributing to Flutter Sign-in Button! 🚀