A modern, feature-rich mobile application for earning cash through surveys, games, and various offers. Built with Flutter using Clean Architecture principles.
CashToEarn allows users to earn money by:
- Completing surveys
- Playing games and reaching milestones
- Engaging with partner offers
- Participating in various in-app tasks
This project follows Clean Architecture with a Feature-First approach:
lib/
βββ core/ # Shared resources and utilities
β βββ config/ # App configuration (router, theme)
β βββ constants/ # App-wide constants
β βββ network/ # API client and networking
β βββ error/ # Error handling
β βββ utils/ # Utility functions
β βββ widgets/ # Reusable UI components
β
βββ features/ # Feature modules
β βββ splash/
β βββ onboarding/
β βββ auth/
β βββ home/
β βββ my_offers/
β βββ cashout/
β βββ profile/
β βββ main_navigation/
β
βββ injection_container.dart # Dependency injection setup
- Data Layer: Models, Data Sources, Repository Implementations
- Domain Layer: Entities, Repository Interfaces, Use Cases
- Presentation Layer: Pages, Widgets, Cubit (State Management)
- flutter_bloc (Cubit pattern)
- equatable (Value equality)
- go_router (Declarative routing)
- dio (HTTP client)
- pretty_dio_logger (API logging)
- get_it (Service locator)
- flutter_screenutil (Responsive sizing)
- animate_do (Animations)
- shimmer (Loading effects)
- smooth_page_indicator (Page indicators)
- cached_network_image (Image caching)
- flutter_svg (SVG support)
- dartz (Functional programming - Either type)
- Primary Purple:
#8B5CF6(Main actions) - Vibrant Blue:
#3B82F6(Accents) - Success Green:
#10B981(Positive actions) - Warning Orange:
#F97316(Alerts) - Error Red:
#EF4444(Errors) - Background:
#0F0F1A(Dark theme) - Card Background:
#1A1A2E(Elevated surfaces)
- Responsive font sizes using
.spfrom ScreenUtil - Custom text styles for headings, body, and captions
- Consistent spacing using
.wand.hfrom ScreenUtil - Design base: 375x812 (iPhone standard)
- Router: GoRouter configuration with route guards
- Theme: Dark theme with custom colors and styles
- API Client: Dio instance with interceptors
- API Endpoints: Centralized endpoint management
- Network Info: Connectivity checks
- Exceptions: Custom exception classes
- Failures: Either pattern for error handling
- Custom buttons with gradients
- Text fields with validation
- Loading indicators
- Error widgets
- Gradient backgrounds
- App initialization
- Route to onboarding or home based on user status
- Welcome screen with consent
- Tutorial overlays
- First-time user experience
- Landing screen
- Create account (Email/Google/Facebook UI)
- Personalization (Gender, Country)
- Username & Avatar selection
- Trending offers
- Top games with milestone rewards
- Offer partners
- Premium partners
- Survey opportunities
- In-app tasks
- Live payouts feed
- Recent activity
- Performance analytics
- Offer tracking
- Balance display
- Payment method selection (PayPal, Venmo, Cash App, etc.)
- Withdrawal interface
- Crypto options
- Gift cards
- User information
- Settings
- Statistics
- Referrals
- Rewards
- Leaderboard
- Persistent bottom navigation
- Side drawer menu
- Tab management
- Flutter SDK: ^3.9.2
- Dart SDK: ^3.9.2
- IDE: VS Code or Android Studio
- Clone the repository
git clone <repository-url>
cd cash-to-earn- Install dependencies
flutter pub get- Run the app
flutter runAndroid:
flutter build apk --release
flutter build appbundle --releaseiOS:
flutter build ios --release# Run all tests
flutter test
# Run with coverage
flutter test --coverage
# Run specific test file
flutter test test/features/auth/auth_cubit_test.dart// 1. Define states
abstract class MyState extends Equatable {}
class MyInitial extends MyState {}
class MyLoading extends MyState {}
class MySuccess extends MyState {
final Data data;
MySuccess(this.data);
}
class MyError extends MyState {
final String message;
MyError(this.message);
}
// 2. Create Cubit
class MyCubit extends Cubit<MyState> {
final UseCase useCase;
MyCubit(this.useCase) : super(MyInitial());
Future<void> fetchData() async {
emit(MyLoading());
final result = await useCase();
result.fold(
(failure) => emit(MyError(failure.message)),
(data) => emit(MySuccess(data)),
);
}
}Domain Layer (Business Logic)
// Entity
class User {
final String id;
final String name;
User({required this.id, required this.name});
}
// Repository Interface
abstract class UserRepository {
Future<Either<Failure, User>> getUser(String id);
}
// Use Case
class GetUser {
final UserRepository repository;
GetUser(this.repository);
Future<Either<Failure, User>> call(String id) {
return repository.getUser(id);
}
}Data Layer (Implementation)
// Model
class UserModel extends User {
UserModel({required super.id, required super.name});
factory UserModel.fromJson(Map<String, dynamic> json) {
return UserModel(
id: json['id'],
name: json['name'],
);
}
}
// Repository Implementation
class UserRepositoryImpl implements UserRepository {
final RemoteDataSource remoteDataSource;
@override
Future<Either<Failure, User>> getUser(String id) async {
try {
final user = await remoteDataSource.getUser(id);
return Right(user);
} catch (e) {
return Left(ServerFailure());
}
}
}// Sizes
Container(
width: 200.w, // Responsive width
height: 100.h, // Responsive height
padding: EdgeInsets.all(16.w),
child: Text(
'Hello',
style: TextStyle(fontSize: 16.sp), // Responsive font
),
)
// Border radius
BorderRadius.circular(12.r)Create .env file for sensitive data:
API_BASE_URL=https://api.cashtoearn.com
API_KEY=your_api_key
- β iOS
- β Android
- β Web
- β macOS
- β Windows
- β Linux
- Create a feature branch
- Follow the existing architecture pattern
- Write tests for new features
- Submit a pull request
This project is licensed under the MIT License.
- Tech Lead: [Your Name]
- Senior Developer: AI Assistant
For questions or support, contact: [[email protected]]
Built with β€οΈ using Flutter