This is a sample Flutter application for managing users. It demonstrates the use of GetX for state management and connects to the JSONPlaceholder API for user data.
- View a list of users
- View details of a specific user
- Add a new user (mock)
- Edit an existing user (mock)
- Delete a user (mock)
- State management using GetX
- Flutter SDK (version 2.5.0 or later)
- Dart SDK (version 2.14.0 or later)
Follow these instructions to set up and run the project on your local machine.
-
Clone the repository:
git clone https://github.com/yourusername/flutter-user-management.git cd flutter-user-management
-
Install dependencies:
flutter pub get
-
Run the application:
flutter run
lib/
├── main.dart
├── models/
│ └── user.dart
├── services/
│ └── user_service.dart
├── controllers/
│ └── user_controller.dart
├── screens/
│ ├── user_list_screen.dart
│ ├── user_detail_screen.dart
│ ├── add_edit_user_screen.dart
└── widgets/
└── user_tile.dart
main.dart
: Entry point of the application.models/
: Contains theUser
model class.services/
: Contains theUserService
class for making API requests.controllers/
: Contains theUserController
class for managing state with GetX.screens/
: Contains the UI screens for listing users, viewing user details, and adding/editing users.widgets/
: Contains reusable UI components.
The application uses the JSONPlaceholder API for mock data. The following endpoints are used:
- Get users:
GET https://jsonplaceholder.typicode.com/users
- Add user:
POST https://jsonplaceholder.typicode.com/users
(mock) - Edit user:
PUT https://jsonplaceholder.typicode.com/users/{id}
(mock) - Delete user:
DELETE https://jsonplaceholder.typicode.com/users/{id}
(mock)
On the main screen, you will see a list of users fetched from the JSONPlaceholder API. Each user tile displays the user's name and email. Tap on a user to view more details.
Tap the floating action button (FAB) on the main screen to navigate to the add user screen. Fill in the user details and tap "Save" to add the user. This is a mock operation and will not persist data.
On the user details screen, tap the "Edit" button to navigate to the edit user screen. Modify the user details and tap "Save" to update the user. This is a mock operation and will not persist data.
On the user details screen, tap the "Delete" button to remove the user. This is a mock operation and will not persist data.
- The application uses mock operations for adding, editing, and deleting users. These operations will not persist data and are for demonstration purposes only.
- The project uses GetX for state management to provide a responsive and efficient user experience.
Feel free to open issues or submit pull requests if you have any suggestions or improvements.
This project is licensed under the MIT License. See the LICENSE file for more details.