Flutter β’ Splash β Onboarding β Login β Home
A modern Flutter application demonstrating a complete mobile authentication pipeline with Material Design 3. Built for university coursework showcasing API integration, state management, and professional UI/UX patterns.
- π§Ύ Overview
- π± Features
- π§° Core Components
- π Getting Started
- π Navigation Flow
- π Authentication
- π§ͺ Test Accounts
- π¦ Dependencies
- ποΈ Project Structure
- π API Integration
- π Notes
- π Resources
KaLbar is a Flutter application that demonstrates a typical mobile entry pipeline and authentication layer. The user experience progresses from a splash screen into a short onboarding sequence, followed by credential-based login and a post-authenticated home view.
Assignment 1:
- β Splash screen implementation with animations
- β Onboarding screens (3 pages) with smooth transitions
- β Login screen GUI with form validation
Assignment 2:
- β Integration with DummyJSON Auth API
- β Dio package for HTTP requests
- β Success & failure result handling with user feedback
The project includes:
- π¦ Splash screen with animated transitions
- π§ Onboarding flow with page indicators
- π Login screen with validation and error handling
- π Home screen displaying authenticated user data
- π§© Authentication model (
AuthUser) and service (AuthService)
- Animated Splash Screen - Smooth entrance animation with fade and scale effects
- Interactive Onboarding - Three-page walkthrough with swipe gestures
- Form Validation - Real-time input validation with error messages
- Loading States - Visual feedback during authentication
- Error Handling - User-friendly error messages via SnackBar
- Remember Me - Checkbox option for persistent sessions
- Social Login UI - Facebook & Google button designs (UI-only)
- Responsive Design - Adapts to various screen sizes
- Material Design 3 - Modern theming with custom color scheme
- Token Management - Access and refresh token handling
Renders a brief entrance animation with fade, scale, and lift effects, then automatically routes to onboarding after 1.4 seconds.
Features:
- Animated logo with multiple synchronized animations
- Precaches onboarding images for smooth transitions
- Custom page route with fade transition
Three swipeable pages implemented with PageView, featuring:
- Dynamic page indicators (dots)
- "Back" and "Next" navigation buttons
- Animated button that expands to "Get Started" on final page
- Smooth content animations on page change
- Rounded card design with shadow effects
Professional authentication interface with:
- β Required field validation (non-empty username and password)
- β³ Loading state with circular progress indicator
- π― Success/failure result handling
- π΄ Error indication with red border and close button
- ποΈ Password visibility toggle
- βοΈ "Remember me" checkbox
- π "Forgot password" link (UI-only)
- π± Social login buttons (UI-only)
Displays authenticated user information:
- User avatar from API
- Full name display
- Username, email, and access token preview
- Logout functionality with smooth transition
- β Flutter SDK (3.0.0 or higher)
- β Dart SDK (3.0.0 or higher)
- π± Android emulator, iOS simulator, or physical device
- π§ Android Studio / VS Code with Flutter extensions
-
Extract the project
cd kalbar-app -
Install dependencies
flutter pub get
-
Run the app
flutter run
Note: All assets (splash screen, onboarding images) are included in the project. No additional setup required!
βββββββββββββββ
β Splash β (1.4s auto-transition)
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββ
β Onboarding β (3 pages, swipeable)
β Page 1 β
β Page 2 β
β Page 3 β
ββββββββ¬βββββββ
β "Get Started"
βΌ
βββββββββββββββ
β Login β (credential input)
ββββββββ¬βββββββ
β Successful auth
βΌ
βββββββββββββββ
β Home β (user dashboard)
ββββββββ¬βββββββ
β "Logout"
βββββββ> Back to Login
All transitions use custom PageRouteBuilder with fade animations for a polished user experience.
- Service:
AuthService(in-memory test accounts + DummyJSON API ready) - Model:
AuthUser(contains id, username, email, name, tokens) - State Management: StatefulWidget with loading and error states
Future<AuthUser> AuthService.login({
required String username,
required String password,
})Inputs:
username: String (trimmed, non-empty)password: String (non-empty)
Output:
- Returns
AuthUserinstance on success - Throws
AuthExceptionwith error message on failure
- π§© Returns populated
AuthUserinstance - π Replaces login route with
HomeScreen(user: user) - πΎ Displays user information on home screen
- π§― Sets error state on username field (red border)
- π¬ Displays SnackBar with error message
- π΄ Shows close button to clear error state
- π― Maintains form state for user correction
Use one of the following accounts to validate the success path:
| Account | Username | Password |
|---|---|---|
| 1 | amir |
123 |
| 2 | test2 |
456 |
| 3 | miro |
789 |
To validate the failure path:
- Submit an incorrect username and/or password
- Observe error message: "Invalid username or password"
- Note the red border on username field and SnackBar notification
dependencies:
flutter:
sdk: flutter
google_fonts: ^6.1.0 # Poppins typography
dio: ^5.4.0 # HTTP client for API integration
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^3.0.0flutter:
assets:
- assets/images/Included Assets:
splash.png- App logo for splash screenonboarding_1.png- First onboarding illustrationonboarding_2.png- Second onboarding illustrationonboarding_3.png- Third onboarding illustration
lib/
βββ main.dart # App entry point and all components
β βββ KaLbarApp # App shell with theme configuration
β βββ AppAssets # Asset path constants
β βββ SplashScreen # Animated splash screen
β βββ OnboardingScreen # Three-page onboarding flow
β βββ LoginScreen # Authentication UI with validation
β βββ HomeScreen # Post-login dashboard
β βββ AuthUser # User domain model
β βββ AuthService # Authentication logic
β βββ AuthException # Custom exception class
β
assets/
βββ images/
βββ splash.png
βββ onboarding_1.png
βββ onboarding_2.png
βββ onboarding_3.png
Note: This is a single-file implementation for educational purposes. Production apps should follow proper separation of concerns.
The app is designed to integrate with the DummyJSON Authentication API.
POST https://dummyjson.com/auth/login
Content-Type: application/json{
"username": "emilys",
"password": "emilyspass",
"expiresInMins": 30
}{
"id": 1,
"username": "emilys",
"email": "emily.johnson@x.dummyjson.com",
"firstName": "Emily",
"lastName": "Johnson",
"gender": "female",
"image": "https://dummyjson.com/icon/emilys/128",
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}{
"message": "Invalid credentials"
}import 'package:dio/dio.dart';
class AuthService {
static final Dio _dio = Dio(
BaseOptions(
baseUrl: 'https://dummyjson.com',
connectTimeout: Duration(seconds: 5),
receiveTimeout: Duration(seconds: 3),
headers: {'Content-Type': 'application/json'},
),
);
static Future<AuthUser> login({
required String username,
required String password,
}) async {
try {
final response = await _dio.post(
'/auth/login',
data: {
'username': username,
'password': password,
'expiresInMins': 30,
},
);
return AuthUser(
id: response.data['id'],
username: response.data['username'],
email: response.data['email'],
firstName: response.data['firstName'],
lastName: response.data['lastName'],
gender: response.data['gender'],
image: response.data['image'],
accessToken: response.data['accessToken'],
refreshToken: response.data['refreshToken'],
);
} on DioException catch (e) {
if (e.response?.statusCode == 400) {
throw const AuthException('Invalid username or password');
}
throw AuthException('Network error: ${e.message}');
} catch (e) {
throw AuthException('Unexpected error: $e');
}
}
}- βΉοΈ Social Login: Facebook/Google buttons are UI-only (OAuth not implemented)
- βΉοΈ Password Recovery: "Forgot password" link is a placeholder
- βΉοΈ Registration: "Sign up" link is not functional
- βΉοΈ Persistence: "Remember me" checkbox doesn't persist data (no local storage)
- βΉοΈ Token Refresh: No automatic token refresh mechanism
- Splash screen with animations
- Three-page onboarding flow
- Login UI with validation
- In-memory authentication service
- Error handling and user feedback
- Home screen with user data display
- DummyJSON API: https://dummyjson.com/docs/auth
- Flutter Documentation: https://docs.flutter.dev
- Dio Package: https://pub.dev/packages/dio
- Google Fonts: https://pub.dev/packages/google_fonts
- Material Design 3: https://m3.material.io
- Poppins Font: https://fonts.google.com/specimen/Poppins
- Flutter Animations: https://docs.flutter.dev/ui/animations
- Flutter Cookbook: https://docs.flutter.dev/cookbook
- Dart Language Tour: https://dart.dev/guides/language/language-tour
- REST API Integration: https://docs.flutter.dev/cookbook/networking/fetch-data
KaLbar - Built with Flutter π
University Mobile Development Assignment β’ 2024