DevClub Summer of Code 2024
App Development: Week 1
Comprehensive PoS Interface - Week 1: Flutter Setup and Basics
Goals:
- Set up the Flutter development environment.
- Learn basic Flutter widgets needed to create login and register pages.
- Implement login and register pages.
- Learn about shared preferences and use them to store and fetch data.
Tasks:
Task 1: Flutter Setup
Objective: Install and set up the Flutter development environment.
- Install Flutter SDK:
- Visit the official Flutter installation page and follow the instructions for your operating system (Windows, macOS, or Linux).
- Ensure you have the following prerequisites installed:
- Git
- A code editor like VS Code or Android Studio
- Set Up IDE:
- VS Code:
- Install Visual Studio Code.
- Install the Flutter and Dart extensions from the VS Code Marketplace.
- Android Studio:
- Download and install Android Studio.
- Install the Flutter plugin through the Plugin Manager.
- Configure an Android/iOS Emulator:
- Verify Installation:
- Open a terminal and run the following command to verify your Flutter installation:
Resources:
Objective: Understand and implement basic Flutter widgets needed for creating login and register pages.
- Widgets to Learn:
Container
Row
and Column
Text
TextField
ElevatedButton
Scaffold
- Showing Snackbar
- The
ScaffoldMessenger
widget in Flutter provides an easy way to display snackbars, material banners, and other messages in your app.
- Use ScaffoldMessenger.of(context).showSnackBar to display a snackbar.
Resources:
Task 3: Learn About Routing
Objective: Understand and implement navigation and routing in Flutter.
- Basic Routing:
- Use
Navigator.push
and Navigator.pop
for simple navigation.
- Named Routes:
- Define named routes for better navigation management.
Resources:
Task 4. Adding Assets to Your Project
Objective: Learn to add images in the UI to make it more attractive .
- Create an
assets
directory:
- In the root directory of your Flutter project, create a new folder named
assets
.
- Add your asset files:
- Place your image files (or other assets) inside the
assets
directory. You can organize them further into subdirectories if needed (e.g., assets/images/
).
-
Declare Assets in pubspec.yaml
:
- Open
pubspec.yaml
:
- In the root directory of your Flutter project, open the
pubspec.yaml
file.
- Declare your assets:
- Under the
flutter
section, declare your assets as follows:
```yaml
flutter:
assets:
- assets/images/
- assets/images/your_image.png
```
- Loading Images from Assets:
- Use the
Image.asset
widget to load an image from your assets:
- Loading Images from the Network:
- Use the
Image.network
widget to load an image from a network URL
Resources
Task 5: Create Login and Register Pages
Objective: Implement login and register pages using given figma file.
- Login Page:
- Create a new screen for the login page.
- Use
TextField
for username and password inputs.
- Add an
ElevatedButton
for the login action.
- Register Page:
- Create a new screen for the register page.
- Use
TextField
for user details (username, email, password, etc.).
- Add an
ElevatedButton
for the register action.
Resources:
Task 6: Learn About Shared Preferences
Objective: Learn how to use shared preferences to store and fetch data for login and registration purposes.
- Install Shared Preferences Package:
- Add the
shared_preferences
package to your pubspec.yaml
file:
dependencies:
shared_preferences: ^2.0.6
- Using Shared Preferences:
- Store user data upon registration.
- Fetch and validate user data during login.
Resources:
BONUS TASKS
Task 1: Improve UI and Use Progress Indicators
Objective: Enhance the UI and add progress indicators for better user experience.
- Improve UI:
- Use
Padding
and Margin
for better spacing.
- Apply
BoxDecoration
to Container
for rounded corners and shadows.
- Progress Indicators:
- Use
CircularProgressIndicator
or LinearProgressIndicator
while waiting for data or during long-running operations.
Resources:
Task 2: Check Internet Connectivity
Objective: Learn how to check and handle internet connectivity.
- Install Connectivity Package:
- Add the
connectivity_plus
package to your pubspec.yaml
file:
dependencies:
connectivity_plus: ^2.0.2
- Using Connectivity Package:
- Check the internet connection status and handle changes.
Resources:
Task 3: Learn about all types of Dialogs
- Dialogs are important UI components in mobile applications for displaying critical information, alerts, prompts, or receiving user input. In Flutter, developers should learn about the following types of dialogs:
1. AlertDialog
2. SimpleDialog
3. Custom Dialogs
Resources