A modern Flutter travel application built with GetX state management, featuring travel packages, blogs, and a clean architecture pattern.
- GetX Navigation: Implemented using
Get.toNamed()
for route management - Bottom Navigation: Custom implementation with
IndexedStack
for state preservation - Route Management: Centralized in
app_pages.dart
with named routes
class AppPages {
static const initial = Routes.main;
static final routes = [
GetPage(
name: Routes.main,
page: () => const MainNavigationScreen(),
binding: NavigationBinding(),
),
];
}
- GetX Controllers: Reactive state management using
.obs
variables - Controller Bindings: Dependency injection through
NavigationBinding
class NavigationBinding extends Bindings {
@override
void dependencies() {
Get.put(NavigationController());
Get.put(HomeController());
Get.put(ExploreController());
Get.put(ThemeController());
Get.put(NotificationsController());
Get.put(ProfileController());
}
}
- Base Search Controller: Reusable search functionality
class BaseSearchController extends GetxController {
final RxString searchQuery = ''.obs;
final RxBool isSearching = false.obs;
void onSearchChanged(String query) {
searchQuery.value = query;
}
void toggleSearch() {
isSearching.value = !isSearching.value;
if (!isSearching.value) {
searchQuery.value = '';
}
}
}
- Data Model:
class TravelPackage {
final String id;
final String name;
final String description;
final double price;
final String duration;
final String imageUrl;
final List<String> highlights;
final String location;
final double rating;
}
- Filtering Categories:
- All
- Popular
- Recent
- Trending
- Blog Model:
class BlogPost {
final String id;
final String title;
final String excerpt;
final String content;
final String author;
final String imageUrl;
final String date;
final List<String> tags;
final int readTime;
}
- Category Filtering:
- All
- Adventure
- Culture
- Food
- Tips
- Dynamic Theme Switching: Implemented using GetX
class ThemeController extends GetxController {
final RxBool isDarkMode = false.obs;
void toggleTheme() {
isDarkMode.value = !isDarkMode.value;
Get.changeThemeMode(isDarkMode.value ? ThemeMode.dark : ThemeMode.light);
}
}
- Featured packages display
- Category filtering
- Search integration
- Responsive grid layout
- Combined view of packages and blogs
- Toggle between content types
- Advanced filtering options
- Search functionality
- User information display
- Editable fields
- Travel statistics
- Preferences management
- Theme toggle implementation
- Navigation to sub-screens
- User preferences management
lib/
βββ data/
β βββ models/ # Data models
β βββ travel_package.dart
β βββ blog_post.dart
βββ presentation/
β βββ bindings/ # Dependency injection
β β βββ navigation_binding.dart
β βββ controllers/ # State management
β β βββ navigation_controller.dart
β β βββ theme_controller.dart
β β βββ profile_controller.dart
β β βββ notifications_controller.dart
β β βββ explore_controller.dart
β βββ routes/ # Navigation
β β βββ app_pages.dart
β βββ screens/ # UI components
β β βββ home/
β β βββ explore/
β β βββ notifications/
β β βββ profile/
β β βββ settings/
β βββ theme/ # App theming
β βββ app_theme.dart
βββ assets/
βββ data/ # Mock JSON data
- Reactive State: Using
.obs
for reactive variables - GetView: Base class for views with controller access
- GetBuilder: For non-reactive state management
- Bindings: Dependency injection setup
// Named route navigation
Get.toNamed('/explore', arguments: {'category': 'adventure'});
// Back navigation with data
Get.back(result: selectedItem);
// Snackbar display
Get.snackbar('Title', 'Message');
class AppTheme {
static ThemeData get lightTheme {
return ThemeData(
primarySwatch: Colors.blue,
scaffoldBackgroundColor: Colors.white,
appBarTheme: const AppBarTheme(
elevation: 0,
backgroundColor: Colors.white,
foregroundColor: Colors.black,
),
);
}
static ThemeData get darkTheme {
return ThemeData.dark().copyWith(
primaryColor: Colors.blue,
appBarTheme: const AppBarTheme(
elevation: 0,
),
);
}
}
- JSON data loading from assets
- Model parsing and serialization
- State persistence using GetX
- Flutter SDK (^3.5.4)
- GetX (^4.6.6)
- Dart SDK (latest stable)
- Clone the repository
git clone https://github.com/Spritan/Flutter_travel_app_dummy.git
- Install dependencies
flutter pub get
- Run the app
flutter run
- iOS (untested)
- Android
- Use
.obs
for reactive state - Implement controllers for each feature
- Use
GetView
for screens with single controller - Implement proper dispose methods
- Feature-based directory structure
- Separate business logic from UI
- Reusable widgets in shared directory
- Constants in dedicated files
try {
// Operation
} catch (e) {
Get.snackbar(
'Error',
e.toString(),
snackPosition: SnackPosition.BOTTOM,
);
}
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License.
- Initial work - Spritan
For support, create an issue in the repository.