Attendance and staff management application for Ma'had Tahfizh al-Qur'an al-Imam as-Syathiby.
Enhanced and customized version of Syathiby Vendor App β https://github.com/creatorb/flutter-syathiby-vendor
π Changelog: See CHANGELOG.md for full version history.
- Quick Start
- Prerequisites
- Installation
- URL Environment Setup
- Development
- Building & Deployment
- Features
- Environment Indicators
- Testing
- Troubleshooting
- Keystore
- Advanced Configuration
- Project Structure
- Contributing
- Branches
- Team & Contact
- License
# 1. Clone repository
git clone https://github.com/creatorb/flutter_syathiby.git
cd flutter_syathiby
# 2. Install dependencies
fvm flutter pub get
# 3. Generate code
fvm flutter pub run build_runner build --delete-conflicting-outputs
# 4. Run app (PROD flavor β automatically uses production URL)
fvm flutter run --flavor prod --dart-define=FLAVOR=prod
# 5. Run app (LOCAL flavor β automatically uses local URL)
fvm flutter run --flavor local --dart-define=FLAVOR=local- Flutter SDK: Managed via FVM
- Android Studio / Xcode (for Android/iOS builds)
- ADB (Android Debug Bridge) for device deployment
- Git
# Windows (PowerShell)
choco install fvm
# macOS
brew tap leoafarias/fvm
brew install fvm
# Linux / Manual
dart pub global activate fvm# Install the Flutter version used by this project
fvm install
# Activate FVM version
fvm usefvm flutter pub getfvm flutter pub run build_runner build --delete-conflicting-outputsSee the Keystore section below.
The app uses automatic flavor-based URL configuration. The backend URL is selected automatically based on the active flavor:
| Flavor | API URL | Link Base | App Name |
|---|---|---|---|
| prod | https://aplikasi.syathiby.id/geten/ |
https://aplikasi.syathiby.id |
Syathiby |
| local | http://192.168.50.100/aplikasi/geten/ |
http://192.168.50.100/aplikasi |
Syathiby LOCAL |
Production:
fvm flutter run --flavor prod --dart-define=FLAVOR=prodβ
Automatically uses: https://aplikasi.syathiby.id
Local Development:
fvm flutter run --flavor local --dart-define=FLAVOR=localβ
Automatically uses: http://192.168.50.100/aplikasi
Note:
--dart-define=FLAVOR=xxxtells the app which flavor is active so the correct URL is selected automatically.
If your local server IP is not 192.168.50.100, edit:
π lib/res/flavor_config.dart
static const Map<String, Map<String, String>> _configs = {
'prod': {
'API_URL': 'https://aplikasi.syathiby.id/geten/',
'LINK_BASE': 'https://aplikasi.syathiby.id',
},
'local': {
'API_URL': 'http://192.168.1.100/aplikasi/geten/', // β Change IP here
'LINK_BASE': 'http://192.168.1.100/aplikasi', // β and here
},
};After editing, rebuild:
fvm flutter clean
fvm flutter pub get
fvm flutter run --flavor local --dart-define=FLAVOR=localYou can also temporarily override the URL at runtime without rebuilding:
- Launch the app (any flavor)
- On the Login screen, long-press the Syathiby logo
- A dialog appears showing the active URL
- Enter your custom URL:
API URL: http://192.168.1.200/aplikasi/geten/ Link Base: http://192.168.1.200/aplikasi - Tap "Save & Restart"
The override is stored in SharedPreferences and persists until manually reset.
- Long-press the logo on the Login screen
- Clear all fields
- Tap "Save & Restart"
The app will revert to the default URL for the active flavor.
Find your server's local IP:
Windows:
ipconfigmacOS / Linux:
ifconfig
# or
ip addr showLook for an IP starting with 192.168.x.x or 10.x.x.x.
Environment detection:
The app automatically detects the environment based on the active URL:
- Local IP (
192.168.x.x,10.x.x.x,172.16β31.x.x,localhost) β LOCAL (red banner) - Other public domain β PROD (green banner, hidden in release)
flutter_syathiby/
βββ lib/res/
βββ flavor_config.dart # URL configuration per flavor
βββ environment_config.dart # Runtime config + URL override logic
βββ env.dart # Legacy (optional, for MAPS_API_KEY)
Issue: URL still wrong after changing flavor
# Make sure to pass --dart-define=FLAVOR
fvm flutter run --flavor local --dart-define=FLAVOR=local
# β οΈ NOT: fvm flutter run --flavor local (missing --dart-define)Issue: Cannot connect to local server
- β Verify the backend server is running
- β Device and server are on the same network (same Wi-Fi)
- β
Test the URL in a browser:
http://192.168.x.x/aplikasi/geten/ - β Check firewall is not blocking the connection
- β
Use the device's IP address, not
localhost
Issue: Environment label shows PROD instead of LOCAL
- Long-press the logo to verify the actual URL in use
- Ensure the URL uses
http://(nothttps://) for local - Confirm the IP matches the local pattern:
192.168.x.x
# PROD flavor (automatically uses https://aplikasi.syathiby.id)
fvm flutter run --flavor prod --dart-define=FLAVOR=prod
# LOCAL flavor (automatically uses http://192.168.50.100/aplikasi)
fvm flutter run --flavor local --dart-define=FLAVOR=local
# Specify device
fvm flutter run -d <device-id> --flavor prod --dart-define=FLAVOR=prod
fvm flutter run -d 127.0.0.1:5555 --flavor local --dart-define=FLAVOR=local- Hot Reload:
r(in terminal while app is running) - Hot Restart:
R - Quit:
q
Run whenever you modify models or environment config:
fvm flutter pub run build_runner build --delete-conflicting-outputsWatch mode (auto-generates on file changes):
fvm flutter pub run build_runner watch --delete-conflicting-outputsIf you encounter cache or dependency issues:
fvm flutter clean
fvm flutter pub get
fvm flutter pub run build_runner build --delete-conflicting-outputs# PROD flavor
fvm flutter build apk --debug --flavor prod --dart-define=FLAVOR=prod
# LOCAL flavor
fvm flutter build apk --debug --flavor local --dart-define=FLAVOR=localOutput: build/app/outputs/flutter-apk/
# PROD flavor
fvm flutter clean
fvm flutter pub get
fvm flutter pub run build_runner build --delete-conflicting-outputs
fvm flutter build apk --release --flavor prod --dart-define=FLAVOR=prod
# LOCAL flavor
fvm flutter clean
fvm flutter pub get
fvm flutter pub run build_runner build --delete-conflicting-outputs
fvm flutter build apk --release --flavor local --dart-define=FLAVOR=local# PROD
fvm flutter clean
fvm flutter pub get
fvm flutter pub run build_runner build --delete-conflicting-outputs
fvm flutter build appbundle --release --flavor prod --dart-define=FLAVOR=prod
# LOCAL
fvm flutter clean
fvm flutter pub get
fvm flutter pub run build_runner build --delete-conflicting-outputs
fvm flutter build appbundle --release --flavor local --dart-define=FLAVOR=localOutput: build/app/outputs/bundle/
Use the PowerShell script to install PROD and LOCAL simultaneously:
.\install-both-apks.ps1Requirements:
- Android device connected via USB or Wi-Fi
- ADB installed and available in PATH
- Both APKs already built (see above)
The script will:
- Validate ADB availability
- Check device connection
- Install
app-local-debug.apkβid.syathiby.app.local - Install
app-prod-debug.apkβid.syathiby.app - Display colored status output (green = success, red = failed)
fvm flutter clean
fvm flutter pub get
fvm flutter pub run build_runner build --delete-conflicting-outputs
fvm flutter build web --release --tree-shake-iconsOutput: build/web/
.htaccess for web deployment:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.html [L]Run web locally:
fvm flutter run -d chrome --web-hostname 192.168.50.100 --web-port 8082The app supports two attendance methods:
- Location (GPS): Validates attendance based on GPS coordinates and location radius
- Network (Wi-Fi / LAN): Validates attendance using the device's public IP address
How Wi-Fi attendance works:
- User selects the attendance method when tapping the check-in/out button
- Wi-Fi mode sends coordinates
(0, 0)as a mode indicator to the backend - The app fetches the allowed public IP from the server endpoint (
settings/wificonfig.php) - The app validates the device's current public IP against the allowed IP via an external IP API
- If validation passes, the attendance request is submitted β backend skips GPS radius check for
(0, 0)coordinates - Error code
03is used for Wi-Fi validation failures
- Automatically checks for a new version on app startup (Home screen)
- Compares current app version with the latest version in CHANGELOG.md on GitHub
- Displays a bottom sheet modal with the changelog content when an update is available
- Provides a direct link to the Play Store for the update
- Non-blocking: users can dismiss and continue using the current version
View and manage staff profile information.
Submit and track leave/permit requests.
View attendance history and activity timeline.
The app provides visual indicators to distinguish between environments:
- LOCAL: Red ribbon with "LOCAL" label (development indicator)
- PROD: No banner β clean UI for end users
Production builds have a clean UI without any environment banner.
- Local environment: "Syathiby LOCAL"
- Production environment: "Syathiby"
- Displays the active ENV label and API URL
- Red for LOCAL, green for PROD
- Long-press logo to override the API URL at runtime
Flavor prod |
Flavor local |
|
|---|---|---|
| Application ID | id.syathiby.app |
id.syathiby.app.local |
| App Label | Syathiby | Syathiby LOCAL |
| Banner | β None (clean UI) | π΄ Red ribbon |
Both flavors can be installed simultaneously on the same device.
A detailed test checklist for Wi-Fi attendance is available at:
π ATTENDANCE_WIFI_TEST_CHECKLIST.md
fvm flutter analyzefvm flutter testfvm flutter pub run build_runner build --delete-conflicting-outputsClear Gradle cache:
# Windows
Remove-Item -Recurse -Force $env:USERPROFILE\.gradle\caches
# macOS/Linux
rm -rf ~/.gradle/cachesThen rebuild:
fvm flutter clean
fvm flutter pub get# Check connected devices
adb devices
# Restart ADB server
adb kill-server
adb start-server
# Connect via Wi-Fi (after USB pairing)
adb tcpip 5555
adb connect <device-ip>:5555Make sure FVM is added to PATH:
# Check FVM installation
fvm --version
# Install FVM if missing
dart pub global activate fvm
# Add to PATH (Windows example)
# Add: %USERPROFILE%\AppData\Local\Pub\Cache\binGenerate a debug keystore for development:
keytool -genkeypair -v `
-keystore debug.keystore `
-alias androiddebugkey `
-keyalg RSA -keysize 2048 `
-validity 10000 `
-storetype pkcs12 `
-storepass android `
-keypass android `
-dname "CN=https://github.com/CreatorB, O=Freelance Fullstack Developer, C=ID"For production builds, use a secure keystore. Store it in a safe location and never commit it to git.
dart run flutter_application_id:main -f flutter_application_id.yaml# Generate configuration
dart run flutter_launcher_icons:generate --override
# Generate icons
dart run flutter_launcher_iconsdart run flutter_native_splash:createflutter_syathiby/
βββ android/ # Android native code & flavor config
βββ ios/ # iOS native code
βββ lib/
β βββ app.dart # Root MaterialApp with environment banner
β βββ data/ # Models, repositories, API services
β βββ presentation/
β β βββ home/ # Home screen with update checker
β β βββ login/ # Login screen with environment badge
β β βββ presence/ # Attendance screen with Wi-Fi option
β βββ res/
β β βββ flavor_config.dart # Built-in URL configuration per flavor
β β βββ environment_config.dart # Runtime config + URL override
β β βββ strings.dart # App constants, dynamic app name
β βββ utils/
β βββ update_checker.dart # GitHub CHANGELOG version check
βββ test/ # Unit & widget tests
βββ build/ # Build outputs (gitignored)
βββ CHANGELOG.md # Version history
βββ ATTENDANCE_WIFI_TEST_CHECKLIST.md # Wi-Fi attendance test guide
βββ install-both-apks.ps1 # Dual APK installer script
βββ pubspec.yaml # Flutter dependencies
βββ README.md # This file
- Create a new branch from
test - Implement features or fixes with clear commit messages
- Update CHANGELOG.md with a new entry
- Test all changes thoroughly
- Open a Pull Request to the
testbranch
feat: add feature X
fix: resolve bug Y
docs: update documentation for Z
chore: update dependencies
refactor: restructure code for A
Active development branch β continuously updated with the latest features and requirements.
Stable branch. Maintained to support the latest production requirements with original features intact.
Ma'had Tahfizh al-Qur'an al-Imam as-Syathiby
Cileungsi, Bogor, Indonesia
- Website: syathiby.com
- Tags:
pondokjabodetabekma'hadtahfizhal-Qur'ansunnahmanhajsalafcileungsibogorindonesiasyathiby
Copyright IT Syathiby 2024
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.