<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Janith Charutha on Medium]]></title>
        <description><![CDATA[Stories by Janith Charutha on Medium]]></description>
        <link>https://medium.com/@charuthajanith?source=rss-19d4675ecd70------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*yC8CHgLrm1rP9vM_</url>
            <title>Stories by Janith Charutha on Medium</title>
            <link>https://medium.com/@charuthajanith?source=rss-19d4675ecd70------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 07:07:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@charuthajanith/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Train a Model Using Teachable Machine and Integrate It into a Mobile App]]></title>
            <link>https://medium.com/@charuthajanith/how-to-train-a-model-using-teachable-machine-and-integrate-it-into-a-mobile-app-081c83025d58?source=rss-19d4675ecd70------2</link>
            <guid isPermaLink="false">https://medium.com/p/081c83025d58</guid>
            <dc:creator><![CDATA[Janith Charutha]]></dc:creator>
            <pubDate>Tue, 07 Jan 2025 20:00:21 GMT</pubDate>
            <atom:updated>2025-01-07T20:00:21.452Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uhHl4VVq7xDpYn16.jpg" /></figure><p><a href="https://teachablemachine.withgoogle.com/train">Teachable Machine</a> by Google is a powerful tool that makes creating machine learning models simple, even for beginners. With just a few steps, you can train a custom model and integrate it into a mobile app for real-world applications. In this guide, we’ll walk you through the process and show you how to bring your trained model to life on a mobile platform.</p><h4>Step 1: Introduction to Teachable Machine</h4><p>💻 Teachable Machine is a no-code tool that allows you to create machine learning models for tasks like image recognition, audio classification, and pose detection. You can train a model in minutes using your webcam, microphone, or uploaded files. This simplicity makes it perfect for prototyping mobile app features.</p><h4>Step 2: Training Your Model</h4><ol><li><strong>Visit Teachable Machine</strong> Go to <a href="https://teachablemachine.withgoogle.com/">https://teachablemachine.withgoogle.com/</a> to get started.</li><li><strong>Choose a Project Type</strong> Select the type of model you want to create:</li></ol><ul><li><strong>Image Project</strong>📸<strong> -</strong> Recognizes objects, people, or other visual inputs.</li><li><strong>Audio Project </strong>🎙️<strong> -</strong> Detects specific sounds or speech patterns.</li><li><strong>Pose Project </strong>👤<strong>-</strong> Identifies body or hand poses.</li></ul><p><strong>3. Create Classes</strong> Classes represent the categories you want the model to learn. For example:</p><ul><li>In an Image Project — “Cats” and “Dogs.”</li><li>In an Audio Project - “Clapping” and “Background Noise.”</li></ul><p><strong>4. Collect Training Data</strong></p><ul><li>Use your webcam or microphone to collect samples for each class.</li><li>Alternatively, upload existing images, audio files, or videos.</li><li>Aim for at least 20–50 samples per class to ensure accuracy.</li></ul><p><strong>5. Train the Model</strong> Click on the <strong>Train Model</strong> button. The platform will process your data and build a model that can recognize the patterns in your training samples.</p><p><strong>6. Test Your Model</strong> Once trained, test your model with new inputs to see how well it performs. You can add more samples and retrain the model if needed.</p><h4>Step 3: Exporting the Model 📤</h4><p>After successfully training your model, it’s time to export it for mobile app integration.</p><ol><li><strong>Click on Export Model</strong></li></ol><ul><li>Choose the <strong>TensorFlow.js</strong> option if you want to use the model in a web app.</li><li>Choose <strong>TensorFlow Lite</strong> for mobile app integration.</li></ul><p><strong>2. Download the Model</strong></p><ul><li>Save the .tflite file for TensorFlow Lite. This file is what you’ll integrate into your mobile app.</li></ul><h4>Step 4: Integrating the Model into a Mobile App 📱</h4><h4>For Android Apps:</h4><ol><li><strong>Set Up TensorFlow Lite in Your Project</strong></li></ol><ul><li>Add TensorFlow Lite dependencies to your build.gradle file:</li></ul><pre>implementation &#39;org.tensorflow:tensorflow-lite:2.11.0&#39;<br>implementation &#39;org.tensorflow:tensorflow-lite-support:0.4.0&#39;</pre><p><strong>2. Import the Model</strong></p><ul><li>Place the .tflite file in the assets folder of your Android project.</li></ul><p><strong>3. Use TensorFlow Lite Interpreter</strong></p><ul><li>Load the model and run inference using TensorFlow Lite’s Interpreter API:</li></ul><pre> Interpreter tflite = new Interpreter(loadModelFile(context));</pre><p><strong>4. Preprocess Input Data</strong></p><ul><li>Ensure the input data format matches the model’s requirements (e.g., resizing images, normalizing pixel values).</li></ul><p><strong>5. Run Predictions</strong></p><ul><li>Pass the preprocessed data to the model and get predictions:</li></ul><pre>float[][] output = new float[1][NUM_CLASSES];<br>tflite.run(inputData, output);</pre><h4>Step 5: Testing and Deployment 🚀</h4><ol><li><strong>Test the App</strong></li></ol><ul><li>Test your mobile app with real-world inputs to ensure the model behaves as expected.</li></ul><ol><li><strong>Optimize the Model</strong></li></ol><ul><li>Use TensorFlow Lite’s optimization tools (e.g., quantization) to reduce the model size and improve performance.</li></ul><p><strong>3. Deploy the App</strong></p><ul><li>Publish your app on the Google Play Store or Apple App Store.</li></ul><h3>Conclusion</h3><p>Teachable Machine makes it incredibly easy to train custom machine learning models. With TensorFlow Lite, you can seamlessly integrate these models into your mobile apps, adding powerful AI-driven features in just a few steps. Whether you’re building a fun project or solving a real-world problem, Teachable Machine and TensorFlow Lite offer the tools to bring your ideas to life.</p><p>Have you tried using Teachable Machine for a mobile app? Share your experience in the comments below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=081c83025d58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter State Management: Understanding Bloc with a Simple Counter App ]]></title>
            <link>https://medium.com/@charuthajanith/flutter-state-management-understanding-bloc-with-a-simple-counter-app-85762e52f57c?source=rss-19d4675ecd70------2</link>
            <guid isPermaLink="false">https://medium.com/p/85762e52f57c</guid>
            <dc:creator><![CDATA[Janith Charutha]]></dc:creator>
            <pubDate>Tue, 31 Dec 2024 01:43:55 GMT</pubDate>
            <atom:updated>2024-12-31T01:43:55.697Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/870/0*VjtfxDDWv7ipn_ha" /></figure><p>State management is a critical part of building robust Flutter applications. Without proper state management, apps can become chaotic as they grow, leading to bugs and unmaintainable code.</p><p>One of the most popular solutions in Flutter for managing state is the <strong>Bloc</strong> (Business Logic Component) library. Today, we’ll explore how Bloc works and build a simple <strong>Counter App</strong> to see it in action.</p><h3>🛠️ What Is State Management in Flutter?</h3><p>In Flutter, <strong>state</strong> refers to any information or data that can change during the lifecycle of the app, like <strong>user input</strong>, <strong>UI interaction</strong>, or <strong>data fetched</strong> from an API.State management is about managing these changes and updating the UI whenever the state changes.</p><h4><strong>Popular state management solutions</strong> for Flutter</h4><ol><li><strong>Provider</strong></li></ol><p><strong>Why It’s Popular,</strong></p><ul><li>Officially recommended by the Flutter team.</li><li>Lightweight, simple, and efficient for small-to-medium apps.</li><li>Great for dependency injection and sharing state across the widget tree.</li></ul><p><strong>Best For</strong>: Beginners or apps with straightforward state needs.</p><p><strong>2. Bloc (Business Logic Componen</strong>t)</p><p><strong>Why It’s Popular,</strong></p><ul><li>Predictable and scalable for large apps.</li><li>Separates business logic from UI using an event-driven architecture.</li><li>Highly testable and suited for complex state flows.</li></ul><p><strong>Best For</strong>: Enterprise-level and large apps requiring strict state management.</p><p><strong>3. Riverpod</strong></p><p><strong>Why It’s Popular,</strong></p><ul><li>An evolution of Provider with more flexibility and fewer limitations.</li><li>Easy to use, context-free, and supports advanced features like dependency injection.</li><li>Can handle both simple and complex use cases.</li></ul><p><strong>Best For</strong>: Developers looking for a modern, versatile solution.</p><p>4. GetX</p><p><strong>Why It’s Popular,</strong></p><ul><li>Simple, all-in-one package for state management, navigation, and dependency injection.</li><li>Minimal boilerplate and reactive state updates.</li><li>Extremely easy to learn and implement.</li></ul><p><strong>Best For</strong>: Quick prototyping or small-to-medium apps needing rapid development.</p><p>5. Redux</p><p><strong>Why It’s Popular</strong>:</p><ul><li>Centralized state management with a single source of truth.</li><li>Proven architecture, especially for apps with shared state across multiple parts.</li><li>Inspired by JavaScript’s Redux, making it familiar to many developers.</li></ul><p><strong>Best For</strong>: Large apps needing structured and predictable state flows.</p><h3>Let’s Look at BLoC! 🚀</h3><p><strong>BLoC (Business Logic Component)</strong> is one of the most popular and powerful state management solutions for Flutter. It’s designed to separate your business logic from the UI, ensuring a clean architecture and maintainable code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*3YheAz0Zv3b6fhZl.png" /></figure><h4>Why use BLoC?</h4><ul><li><strong>Predictability </strong>- With its event-driven approach, you always know how your app will respond to a specific event.</li><li><strong>Scalability </strong>- Perfect for large apps with complex state flows.</li><li><strong>Testability -</strong> Easily test your business logic independently of the UI.</li></ul><h4>How Bloc Works</h4><p>Bloc operates on three core principles,</p><ol><li><strong>Event</strong>: Represents actions triggered by the user or the app (e.g., button press).</li><li><strong>State</strong>: Represents the app’s state at a given time.</li><li><strong>Bloc</strong>: The bridge between events and states. It listens to events, processes logic, and emits new states.</li></ol><h4>Here’s a <strong>simple Counter App example</strong> using BLoC.</h4><p>1️⃣ <strong>Event</strong>: Represents user actions (e.g., incrementing or decrementing the counter).<br>2️⃣ <strong>State</strong>: Represents the state of the app (e.g., the current counter value).<br>3️⃣ <strong>Bloc</strong>: Manages the business logic and determines how the state changes in response to events.</p><p>Stay tuned as we break this down step by step and build a simple Counter App using BLoC. It’s easier than you think! Let’s dive in. 👇</p><p>Step 1: Add the flutter_bloc Package,</p><p>First, add the flutter_bloc package to your project by running.</p><pre>flutter pub add flutter_bloc</pre><p>Step 2: Create a <strong>CounterBloc</strong> class with events,</p><pre>enum CounterEvent { increment, decrement }<br><br>class CounterBloc extends Bloc&lt;CounterEvent, int&gt; {<br>  CounterBloc() : super(0);<br><br>  @override<br>  Stream&lt;int&gt; mapEventToState(CounterEvent event) async* {<br>    switch (event) {<br>      case CounterEvent.increment:<br>        yield state + 1;<br>        break;<br>      case CounterEvent.decrement:<br>        yield state - 1;<br>        break;<br>    }<br>  }<br>}</pre><p>Step 3: Build the UI,</p><pre>class CounterBlocApp extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return BlocProvider(<br>      create: (_) =&gt; CounterBloc(),<br>      child: Scaffold(<br>        appBar: AppBar(title: Text(&#39;Bloc Counter App&#39;)),<br>        body: BlocBuilder&lt;CounterBloc, int&gt;(<br>          builder: (context, count) {<br>            return Center(<br>              child: Text(&#39;Count: $count&#39;, style: TextStyle(fontSize: 24)),<br>            );<br>          },<br>        ),<br>        floatingActionButton: Column(<br>          mainAxisAlignment: MainAxisAlignment.end,<br>          children: [<br>            FloatingActionButton(<br>              onPressed: () =&gt; context.read&lt;CounterBloc&gt;().add(CounterEvent.increment),<br>              child: Icon(Icons.add),<br>            ),<br>            SizedBox(height: 10),<br>            FloatingActionButton(<br>              onPressed: () =&gt; context.read&lt;CounterBloc&gt;().add(CounterEvent.decrement),<br>              child: Icon(Icons.remove),<br>            ),<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>Step 4: Run the App,</p><p>Run the app and test it:</p><ul><li>Press the “+” button to increase the count.</li><li>Press the “-” button to decrease the count.</li><li>Watch the UI update automatically as the state changes!</li></ul><h4>Wrap-Up 🎉</h4><p>State management doesn’t have to be complicated! By using <strong>Bloc</strong>, you can manage your app’s state efficiently while keeping your code clean and testable.</p><p>💡 <strong>Next Steps:</strong></p><ul><li>Try extending the Counter App by adding features like resetting the counter or persisting the count across sessions.</li><li>Explore Bloc’s advanced features like multi-bloc and BlocListener.</li></ul><p>Let me know your thoughts or questions in the comments! Happy coding🚀</p><p>#Flutter #Bloc #StateManagement #FlutterDevelopment #TechBlog</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85762e52f57c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a To-Do List App with Firebase CRUD Using Cloud Firestore ]]></title>
            <link>https://medium.com/@charuthajanith/building-a-to-do-list-app-with-firebase-crud-using-cloud-firestore-d5eb8017b22a?source=rss-19d4675ecd70------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5eb8017b22a</guid>
            <dc:creator><![CDATA[Janith Charutha]]></dc:creator>
            <pubDate>Sat, 28 Dec 2024 02:12:52 GMT</pubDate>
            <atom:updated>2024-12-28T02:12:52.553Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*QxqKB9NUG2jw2CNzRsMcCQ.png" /></figure><p>In this guide, we’ll create a simple To-Do list app using Flutter and Firebase’s <strong>Cloud Firestore</strong>. This app demonstrates how to perform <strong>CRUD operations</strong> — Create, Read, Update, and Delete data.</p><h3>🛠️ What You’ll Learn:</h3><ol><li><strong>Firestore Configuration</strong> in Flutter.</li><li>Performing <strong>CRUD operations</strong> with Firestore.</li><li>Creating an interactive UI for a To-Do list app.</li></ol><h4>Step 1: Setting Up Firebase &amp; Firestore</h4><ol><li>Configure Firebase in your Flutter app. (Refer to my <a href="https://medium.com/@charuthajanith/flutter-firebase-step-by-step-configuration-guide-for-beginners-b20b4b219097">previous guide</a> on Firebase setup.)</li><li>Add the cloud_firestore plugin to your project</li></ol><pre>flutter pub add cloud_firestore</pre><p>3. Initialize Firebase in your project</p><pre>import &#39;package:firebase_core/firebase_core.dart&#39;;<br><br>void main() async {<br>  WidgetsFlutterBinding.ensureInitialized();<br>  await Firebase.initializeApp();<br>  runApp(MyApp());<br>}</pre><h4>Step 2: Create Firestore Database</h4><ol><li>Go to the Firebase Console → Cloud Firestore → Create Database.</li><li>Set up Firestore in test mode (for learning purposes).</li></ol><h4>Step 3: Flutter code for To-Do List</h4><ol><li>main.dart</li></ol><pre>import &#39;package:firebase_core/firebase_core.dart&#39;;<br>import &#39;package:flutter/material.dart&#39;;<br><br>import &#39;firebase_options.dart&#39;;<br>import &#39;pages/homepage.dart&#39;;<br><br>void main() async{<br>  WidgetsFlutterBinding.ensureInitialized();<br>  await Firebase.initializeApp(<br>    options: DefaultFirebaseOptions.currentPlatform,<br>  );<br>  runApp(const MyApp());<br>}<br><br>class MyApp extends StatefulWidget {<br>  const MyApp({super.key});<br><br>  @override<br>  State&lt;MyApp&gt; createState() =&gt; _MyAppState();<br>}<br><br>class _MyAppState extends State&lt;MyApp&gt; {<br>  @override<br>  Widget build(BuildContext context) {<br>    return const MaterialApp(<br>      debugShowCheckedModeBanner: false,<br>      title: &quot;CRUD&quot;,<br>      home: HomePage(),<br>    );<br>  }<br>}</pre><p>2. Firebase Integration.</p><pre>import &#39;package:cloud_firestore/cloud_firestore.dart&#39;;<br><br>class FirestoreService {<br>  // get collection of notes<br>  final CollectionReference notes =<br>      FirebaseFirestore.instance.collection(&#39;notes&#39;);<br><br>// CREATE: add a new note<br>  Future&lt;void&gt; addNote(String note) {<br>    return notes.add({<br>      &#39;note&#39;: note,<br>      &#39;timestamp&#39;: Timestamp.now(),<br>    });<br>  }<br><br>//   READ: get notes from database<br>  Stream&lt;QuerySnapshot&lt;Object?&gt;&gt; getNoteStream() {<br>    final notesStream =<br>        notes.orderBy(&#39;timestamp&#39;, descending: true).snapshots();<br>    return notesStream;<br>  }<br><br>//   UPDATE: update notes given a doc id<br>  Future&lt;void&gt; updateNote(String docID, String newNote) {<br>    return notes.doc(docID).update({<br>      &#39;note&#39;: newNote,<br>      &#39;timestamp&#39;: Timestamp.now(),<br>    });<br>  }<br><br>// DELETE:<br>  Future&lt;void&gt; deleteNote(String docID) {<br>    return notes.doc(docID).delete();<br>  }<br>}</pre><p>3.Create a HomePage with a UI for adding, displaying, editing, and deleting notes.</p><pre>import &#39;package:cloud_firestore/cloud_firestore.dart&#39;;<br>import &#39;package:crud/services/firestore.dart&#39;;<br>import &#39;package:flutter/material.dart&#39;;<br><br>class HomePage extends StatefulWidget {<br>  const HomePage({super.key});<br><br>  @override<br>  State&lt;HomePage&gt; createState() =&gt; _HomePageState();<br>}<br><br>class _HomePageState extends State&lt;HomePage&gt; {<br>  //firestore<br>  final FirestoreService firestoreService = FirestoreService();<br><br>  // TextEditingController for handling the text input<br>  TextEditingController textController = TextEditingController();<br><br>  // open dialog box to add note<br>  void openNoteBox({String? docID, String? existingNote}) {<br>    // Pre-fill the controller if editing a note<br>    if (existingNote != null) {<br>      textController.text = existingNote;<br>    } else {<br>      textController.clear();<br>    }<br><br>    showDialog(<br>      context: context,<br>      builder: (context) =&gt; AlertDialog(<br>        title: Text(docID == null ? &quot;Add Note&quot; : &quot;Edit Note&quot;),<br>        content: TextField(<br>          controller: textController,<br>          decoration: InputDecoration(<br>            hintText: &quot;Enter your note here...&quot;,<br>          ),<br>        ),<br>        actions: [<br>          ElevatedButton(<br>            onPressed: () async {<br>              String noteText = textController.text.trim();<br><br>              if (noteText.isEmpty) {<br>                // Prevent saving empty notes<br>                Navigator.pop(context);<br>                return;<br>              }<br><br>              if (docID == null) {<br>                // Add a new note<br>                await firestoreService.addNote(noteText);<br>              } else {<br>                // Update an existing note<br>                await firestoreService.updateNote(docID, noteText);<br>              }<br><br>              textController.clear(); // Clear the text field<br>              Navigator.pop(context); // Close the dialog<br>            },<br>            child: Text(docID == null ? &quot;Add&quot; : &quot;Update&quot;),<br>          ),<br>          TextButton(<br>            onPressed: () {<br>              textController.clear();<br>              Navigator.pop(context); // Close the dialog without saving<br>            },<br>            child: Text(&quot;Cancel&quot;),<br>          ),<br>        ],<br>      ),<br>    );<br>  }<br><br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(<br>        title: Center(child: Text(&quot; Firebase CRUD&quot;)),<br>      ),<br>      floatingActionButton: FloatingActionButton(<br>        onPressed: openNoteBox,<br>        child: Icon(Icons.add),<br>      ),<br>      body: StreamBuilder&lt;QuerySnapshot&gt;(<br>        stream: firestoreService.getNoteStream(),<br>        builder: (context, snapshot) {<br>          if (snapshot.hasData) {<br>            List notesList = snapshot.data!.docs;<br>            return ListView.builder(<br>                itemCount: notesList.length,<br>                itemBuilder: (context, index) {<br>                  DocumentSnapshot document = notesList[index];<br>                  String docID = document.id;<br><br>                  Map&lt;String, dynamic&gt; data =<br>                      document.data() as Map&lt;String, dynamic&gt;;<br>                  String noteText = data[&#39;note&#39;];<br><br>                  return ListTile(<br>                      title: Text(noteText),<br>                      trailing: Row(<br>                        mainAxisSize: MainAxisSize.min,<br>                        children: [<br>                          IconButton(onPressed: ()=&gt;openNoteBox(docID: docID),<br>                      icon: Icon(Icons.settings),),<br>                          IconButton(onPressed: ()=&gt;firestoreService.deleteNote(docID),<br>                            icon: Icon(Icons.delete),),<br>                        ],<br>                      ));<br>                });<br>          } else {<br>            return const Text(&#39;No Notes..&#39;);<br>          }<br>        },<br>      ),<br>    );<br>  }<br>}<br></pre><h4>Step 4: Testing Your To-Do App</h4><p>Run your app and test</p><ul><li><strong>Add Tasks.</strong></li><li><strong>Read Tasks.</strong></li><li><strong>Update Tasks.</strong></li><li><strong>Delete Tasks.</strong></li></ul><h3>Wrap-Up 🎉</h3><p>In this tutorial, we built a simple To-Do app with Firebase’s Cloud Firestore. This is just the beginning! You can expand this app with features like authentication, priority sorting, or even analytics. Firebase makes it easy to scale your app while Flutter provides a seamless UI experience.</p><p>🚀 <em>Start building today, and let me know what amazing apps you create!</em></p><p>#Flutter #Firebase #Firestore #CRUD #MobileDevelopment #ToDoApp</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5eb8017b22a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter + Firebase: Step-by-Step Configuration Guide for Beginners ]]></title>
            <link>https://medium.com/@charuthajanith/flutter-firebase-step-by-step-configuration-guide-for-beginners-b20b4b219097?source=rss-19d4675ecd70------2</link>
            <guid isPermaLink="false">https://medium.com/p/b20b4b219097</guid>
            <dc:creator><![CDATA[Janith Charutha]]></dc:creator>
            <pubDate>Fri, 27 Dec 2024 13:50:14 GMT</pubDate>
            <atom:updated>2024-12-27T13:50:14.707Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Nzr975edopFR5Jie.png" /></figure><p>Flutter and Firebase together provide a powerful toolkit for building modern, scalable apps with real-time backend capabilities. From user authentication to real-time databases, Firebase seamlessly integrates with Flutter to simplify app development.</p><p>In this blog, I’ll guide you through the step-by-step process of configuring Firebase in your Flutter project. Whether you’re new to Flutter or Firebase, this guide will help you get started! 🛠️</p><h4>What is Firebase?</h4><p>Firebase is a platform by Google offering various backend services such as authentication, real-time databases, cloud functions, storage, and much more. It eliminates the need to set up and manage a separate backend infrastructure, making it a popular choice for developers.<br>2. Prerequisites</p><p>Before starting, ensure you have the following:</p><ul><li>Flutter installed on your machine (installation guide).</li><li>A Google account for accessing Firebase.</li><li>Basic knowledge of Flutter.</li></ul><h3>3. Setting Up Firebase for Your Project</h3><h4>Step 1: Create a Firebase Project</h4><ol><li>Go to <a href="https://console.firebase.google.com/"><em>Firebase Console</em>.</a></li><li>Click <strong>“Create a Project”.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MJKyMEV3_ub2cz1H4PJ4lA.png" /></figure><p>3. Provide a name for your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zNI1xM2ETm7bD1Mm7aNWzQ.png" /></figure><p>4. Follow the setup wizard and enable Google Analytics (optional).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*krcyxRveNlJhyXFFa3tVew.png" /></figure><p>5. Once created, you’ll land on the Firebase project dashboard. 🚀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SuIkXJkzN42KRbPuKJgODw.png" /></figure><p>Add Your Flutter App to Firebase</p><ol><li>In the Firebase console, click on <strong>“Flutter logo”</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*vjpgVE2FYPJIXDP8g4uc8Q.png" /></figure><p>Then you can see,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*WL2mMEHwAqec7RhG54QCkA.png" /></figure><p>2. Prepare Your Workspace</p><h3>Prerequisites</h3><ul><li>Install your preferred <a href="https://flutter.io/get-started/editor/">editor or IDE</a>.</li><li>Set up a device or emulator for running your app. <a href="https://developer.android.com/studio/run/managing-avds?authuser=0">Emulators</a> must use an emulator image with Google Play.</li><li>Make sure that your app meets the following requirements:Targets API level 21 (Lollipop) or higher, Uses Android 5.0 or higher</li><li><a href="https://flutter.io/get-started/install/">Install Flutter</a> for your specific operating system, including the following: Flutter SDK, Supporting libraries, Platform-specific software and SDKs.</li><li><a href="https://console.firebase.google.com/?authuser=0">Sign into Firebase</a> using your Google account.</li></ul><p>If you don’t already have a Flutter app, you can complete the <a href="https://flutter.io/get-started/test-drive/#androidstudio">Get Started: Test Drive</a> to create a new Flutter app using your preferred editor or IDE.</p><ol><li><strong>Install Firebase CLI</strong>:</li></ol><ul><li>Download the Firebase CLI from Firebase CLI Documentation.</li><li>Run the command</li></ul><pre>npm install -g firebase-tools</pre><ul><li>Login to Firebase</li></ul><pre>firebase login</pre><h4>Step 3: Install and Run FlutterFire CLI</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ORpgtI_m6nTtMGAmYQhvNA.png" /></figure><p><strong>Install FlutterFire CLI</strong></p><pre>dart pub global activate flutterfire_cli</pre><p>flutterfire configure</p><p>From your Flutter project directory, run the following command to start the app configuration workflow,</p><pre>flutterfire configure</pre><p>This automatically registers your per-platform apps with Firebase and adds a lib/firebase_options.dart configuration file to your Flutter project.</p><h4>Step 4: Initialize Firebase and Add Plugins</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*el2j04McafBHvugYN_qfxQ.png" /></figure><p><strong>Add Firebase Core Plugin</strong>:</p><ul><li>From your Flutter project directory, run the following command to install the core plugin</li></ul><pre>flutter pub add firebase_core</pre><ul><li>From your Flutter project directory, run the following command to ensure that your Flutter app’s Firebase configuration is up-to-date</li></ul><pre>flutterfire configure</pre><ul><li>In your lib/main.dart file, import the Firebase core plugin and the configuration file you generated earlier. Also in your lib/main.dart file, initialize Firebase using the DefaultFirebaseOptions object exported by the configuration file</li></ul><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:firebase_core/firebase_core.dart&#39;;<br>import &#39;firebase_options.dart&#39;;<br><br>void main() async {<br>  WidgetsFlutterBinding.ensureInitialized();<br>  await Firebase.initializeApp(<br>    options: DefaultFirebaseOptions.currentPlatform,<br>  );<br>  runApp(MyApp());<br>}<br><br>class MyApp extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      home: Scaffold(<br>        appBar: AppBar(title: Text(&quot;Firebase Configured&quot;)),<br>        body: Center(child: Text(&quot;Welcome to Firebase!&quot;)),<br>      ),<br>    );<br>  }<br>}</pre><h4>Rebuild your Flutter application</h4><pre>flutter run</pre><h3>Conclusion</h3><p>Setting up Firebase in Flutter may seem intimidating at first, but with these steps, you’ll have a fully functional Firebase backend connected to your app in no time. From authentication to real-time data and storage, Firebase makes app development seamless and efficient.</p><p>Stay tuned for future posts where we’ll dive into using Firebase services like <strong>Firestore</strong>, <strong>Storage</strong>, and <strong>Cloud Functions</strong> to build robust apps. 🚀</p><p>Let’s build the future together with Flutter and Firebase! 💙</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b20b4b219097" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Navigation in Flutter: Routes and Routing Types]]></title>
            <link>https://medium.com/@charuthajanith/mastering-navigation-in-flutter-routes-and-routing-types-99a156c73bd7?source=rss-19d4675ecd70------2</link>
            <guid isPermaLink="false">https://medium.com/p/99a156c73bd7</guid>
            <dc:creator><![CDATA[Janith Charutha]]></dc:creator>
            <pubDate>Mon, 23 Dec 2024 07:40:22 GMT</pubDate>
            <atom:updated>2024-12-23T07:40:22.232Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*L6W-qhKbqjFfs1A_" /></figure><p>When building mobile apps, smooth navigation between different screens is crucial for a seamless user experience. In Flutter, navigation is powered by <strong>routes</strong>. Whether you’re creating a small app with a few pages or a large-scale application with multiple complex flows, understanding routing types is essential.</p><p>In this blog, we’ll explore,</p><ol><li>What routes are in Flutter.</li><li>How to navigate between pages.</li><li>Different routing types (basic, named, and on-generate routes).</li><li>Advanced routing with packages like <strong>go_router</strong> or <strong>auto_route</strong>.</li></ol><h4>What is a Route?</h4><p>In Flutter, a <strong>route</strong> is simply a screen or page in your application. Each route is a widget, and Flutter provides multiple ways to navigate between these routes.</p><p>For example:</p><ul><li><strong>Home Screen</strong> is one route.</li><li><strong>Profile Screen</strong> is another route.</li></ul><h4>Basic Navigation,Using Navigator.push() and Navigator.pop()</h4><p>For small apps, you can use <strong>basic navigation</strong> with the Navigator widget.</p><pre>import &#39;package:flutter/material.dart&#39;;<br><br>void main() {<br>  runApp(MyApp());<br>}<br><br>class MyApp extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      home: HomeScreen(),<br>    );<br>  }<br>}<br><br>class HomeScreen extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(title: Text(&#39;Home Screen&#39;)),<br>      body: Center(<br>        child: ElevatedButton(<br>          onPressed: () {<br>            Navigator.push(<br>              context,<br>              MaterialPageRoute(builder: (context) =&gt; SecondScreen()),<br>            );<br>          },<br>          child: Text(&#39;Go to Second Screen&#39;),<br>        ),<br>      ),<br>    );<br>  }<br>}<br><br>class SecondScreen extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(title: Text(&#39;Second Screen&#39;)),<br>      body: Center(<br>        child: ElevatedButton(<br>          onPressed: () {<br>            Navigator.pop(context);<br>          },<br>          child: Text(&#39;Back to Home Screen&#39;),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>In this example:</p><ul><li>Navigator.push() adds a new screen to the stack.</li><li>Navigator.pop() removes the current screen from the stack.</li></ul><h4>Named Routes, Easier Navigation</h4><p>For apps with multiple screens, <strong>named routes</strong> offer a cleaner and more scalable approach.</p><p><strong>Step 1</strong>: Define the routes in MaterialApp</p><pre>MaterialApp(<br>  initialRoute: &#39;/&#39;,<br>  routes: {<br>    &#39;/&#39;: (context) =&gt; HomeScreen(),<br>    &#39;/second&#39;: (context) =&gt; SecondScreen(),<br>  },<br>);</pre><p><strong>Step 2</strong>: Navigate using route names</p><p>This approach keeps your navigation logic centralized and easier to manage.</p><pre>Navigator.pushNamed(context, &#39;/second&#39;);</pre><h4>On-Generate Route, Dynamic Routing</h4><p>When you need more flexibility, such as passing arguments dynamically, use <strong>onGenerateRoute</strong></p><pre>MaterialApp(<br>  onGenerateRoute: (settings) {<br>    if (settings.name == &#39;/second&#39;) {<br>      final args = settings.arguments as String;<br>      return MaterialPageRoute(<br>        builder: (context) =&gt; SecondScreen(data: args),<br>      );<br>    }<br>    return null;<br>  },<br>);</pre><p>Navigate with arguments</p><pre>Navigator.pushNamed(<br>  context,<br>  &#39;/second&#39;,<br>  arguments: &#39;Hello from Home Screen!&#39;,<br>);</pre><p>Access the arguments in the second screen</p><pre>class SecondScreen extends StatelessWidget {<br>  final String data;<br><br>  SecondScreen({required this.data});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(title: Text(&#39;Second Screen&#39;)),<br>      body: Center(child: Text(data)),<br>    );<br>  }<br>}</pre><h4>Advanced Routing, Using Packages</h4><p>For larger apps with complex navigation flows, Flutter offers powerful routing libraries like <strong>go_router</strong> and <strong>auto_route</strong>.</p><p>1. go_router</p><p>This library simplifies routing and supports deep linking</p><pre>dependencies:<br>  go_router: ^7.0.0</pre><pre>final GoRouter router = GoRouter(<br>  routes: [<br>    GoRoute(<br>      path: &#39;/&#39;,<br>      builder: (context, state) =&gt; HomeScreen(),<br>    ),<br>    GoRoute(<br>      path: &#39;/second&#39;,<br>      builder: (context, state) =&gt; SecondScreen(),<br>    ),<br>  ],<br>);<br><br>void main() {<br>  runApp(MaterialApp.router(<br>    routerConfig: router,<br>  ));<br>}</pre><p>Understanding <strong>routing in Flutter</strong> is essential for creating apps with smooth navigation. Whether you’re building a small app or a large-scale application, Flutter offers various routing options to suit your needs:</p><ul><li><strong>Basic routing</strong> for small projects.</li><li><strong>Named and on-generate routes</strong> for medium-to-large apps.</li><li><strong>Advanced routing libraries</strong> for complex navigation flows.</li></ul><p>💡 <strong>Pro Tip,</strong> Start simple, and as your app grows, explore libraries like <strong>go_router</strong> to manage routing more effectively.</p><p><strong>Which routing method do you use the most in Flutter? Let’s discuss in the comments!</strong> 💬</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99a156c73bd7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering the Navbar in Flutter: Basics and Customizations]]></title>
            <link>https://medium.com/@charuthajanith/mastering-the-navbar-in-flutter-basics-and-customizations-f53d805fb260?source=rss-19d4675ecd70------2</link>
            <guid isPermaLink="false">https://medium.com/p/f53d805fb260</guid>
            <dc:creator><![CDATA[Janith Charutha]]></dc:creator>
            <pubDate>Sun, 22 Dec 2024 02:17:58 GMT</pubDate>
            <atom:updated>2024-12-22T02:17:58.918Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_kePP9hCtXiQWHSg" /></figure><p>The <strong>Navigation Bar (Navbar)</strong> is a vital component of mobile app design. It helps users seamlessly navigate between different screens in your app. In Flutter, you can create and customize navbars effortlessly using widgets like <strong>BottomNavigationBar</strong> and <strong>AppBar</strong>. Today, we’ll explore how to create a Navbar, customize its look and feel, and enhance your app’s user experience. 🚀</p><h4>What is a Navbar in Flutter?</h4><p>A <strong>Navbar</strong> is a user interface element that allows users to move between multiple views or sections of an app. Flutter provides built-in widgets like:</p><ol><li><strong>BottomNavigationBar,</strong> For navigation at the bottom of the screen.</li><li><strong>AppBar with Tabs,</strong> For top navigation combined with a tabbed layout.</li></ol><p>Both options are highly customizable to match your app’s theme and style. 🎨</p><h4>Creating a Basic Bottom Navbar</h4><pre>import &#39;package:flutter/material.dart&#39;;<br><br>void main() {<br>  runApp(MyApp());<br>}<br><br>class MyApp extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      home: BottomNavBarExample(),<br>    );<br>  }<br>}<br><br>class BottomNavBarExample extends StatefulWidget {<br>  @override<br>  _BottomNavBarExampleState createState() =&gt; _BottomNavBarExampleState();<br>}<br><br>class _BottomNavBarExampleState extends State&lt;BottomNavBarExample&gt; {<br>  int _selectedIndex = 0;<br><br>  final List&lt;Widget&gt; _pages = [<br>    Center(child: Text(&#39;Home Page&#39;)),<br>    Center(child: Text(&#39;Search Page&#39;)),<br>    Center(child: Text(&#39;Profile Page&#39;)),<br>  ];<br><br>  void _onItemTapped(int index) {<br>    setState(() {<br>      _selectedIndex = index;<br>    });<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(title: Text(&#39;Navbar Example&#39;)),<br>      body: _pages[_selectedIndex],<br>      bottomNavigationBar: BottomNavigationBar(<br>        currentIndex: _selectedIndex,<br>        onTap: _onItemTapped,<br>        items: const &lt;BottomNavigationBarItem&gt;[<br>          BottomNavigationBarItem(<br>            icon: Icon(Icons.home),<br>            label: &#39;Home&#39;,<br>          ),<br>          BottomNavigationBarItem(<br>            icon: Icon(Icons.search),<br>            label: &#39;Search&#39;,<br>          ),<br>          BottomNavigationBarItem(<br>            icon: Icon(Icons.person),<br>            label: &#39;Profile&#39;,<br>          ),<br>        ],<br>      ),<br>    );<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*GDgH9xFcVDMftjgFR1N54g.png" /></figure><h4>Advanced Customizations</h4><ol><li>Changing Colors</li></ol><pre>bottomNavigationBar: BottomNavigationBar(<br>  backgroundColor: Colors.teal,<br>  selectedItemColor: Colors.white,<br>  unselectedItemColor: Colors.grey,<br>  items: [/* items */],<br>)</pre><p>2. Adding Icons and Labels</p><pre>BottomNavigationBarItem(<br>  icon: Icon(Icons.dashboard),<br>  label: &#39;Dashboard&#39;,<br>)</pre><p>3. Adding Animations</p><p><strong>dependencies:<br> animated_bottom_navigation_bar: ^1.0.0</strong></p><pre>AnimatedBottomNavigationBar(<br>  icons: [Icons.home, Icons.search, Icons.person],<br>  activeIndex: _selectedIndex,<br>  onTap: _onItemTapped,<br>  backgroundColor: Colors.blue,<br>);</pre><p>4. Creating a Top Navbar with Tabs</p><p>For apps requiring tab navigation, you can combine an <strong>AppBar</strong> with the <strong>TabBar</strong> widget.</p><pre>import &#39;package:flutter/material.dart&#39;;<br><br>void main() {<br>  runApp(MyApp());<br>}<br><br>class MyApp extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      home: TabBarExample(),<br>    );<br>  }<br>}<br><br>class TabBarExample extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return DefaultTabController(<br>      length: 3,<br>      child: Scaffold(<br>        appBar: AppBar(<br>          title: Text(&#39;Top Navbar Example&#39;),<br>          bottom: TabBar(<br>            tabs: [<br>              Tab(icon: Icon(Icons.home), text: &#39;Home&#39;),<br>              Tab(icon: Icon(Icons.search), text: &#39;Search&#39;),<br>              Tab(icon: Icon(Icons.person), text: &#39;Profile&#39;),<br>            ],<br>          ),<br>        ),<br>        body: TabBarView(<br>          children: [<br>            Center(child: Text(&#39;Home Page&#39;)),<br>            Center(child: Text(&#39;Search Page&#39;)),<br>            Center(child: Text(&#39;Profile Page&#39;)),<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*MMCqrbBdxUiONbHTza6I_w.png" /></figure><p>The <strong>Navbar</strong> is an essential tool for creating smooth and user-friendly navigation in Flutter apps. Whether it’s a <strong>BottomNavigationBar</strong> or a <strong>Top TabBar</strong>, the customizations available make it easy to design a Navbar that aligns with your app’s theme. 🌟</p><ul><li>Use <strong>basic navbars</strong> for simplicity.</li><li>Try <strong>custom colors, animations, or shapes</strong> for a standout design.</li><li>Explore packages like animated_bottom_navigation_bar or convex_bottom_bar for advanced features. 🚀</li></ul><p><strong>Let’s make navigation seamless and beautiful!</strong> 🧑‍💻</p><p><strong>What’s your favorite Navbar design in Flutter? Let me know in the comments!</strong> 💬</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f53d805fb260" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Master Essential Components for Beautiful Apps! ]]></title>
            <link>https://medium.com/@charuthajanith/master-essential-components-for-beautiful-apps-16ff4268f1ea?source=rss-19d4675ecd70------2</link>
            <guid isPermaLink="false">https://medium.com/p/16ff4268f1ea</guid>
            <dc:creator><![CDATA[Janith Charutha]]></dc:creator>
            <pubDate>Fri, 20 Dec 2024 05:21:54 GMT</pubDate>
            <atom:updated>2024-12-20T05:21:54.152Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*G2A9qIeJ9geHRdG1.jpg" /></figure><p>In Flutter, the <strong>App Bar</strong> is one of the most commonly used UI components. It’s a crucial part of the app’s layout and provides a way to display titles, icons, or actions. A <strong>Transparent App Bar</strong>, on the other hand, offers a modern, sleek look, where the app’s content or background can be seen through the top bar. This post will walk you through how to use these two components to enhance your Flutter apps’ design.</p><h4>What is an App Bar?</h4><p>The <strong>App Bar</strong> in Flutter is a material design widget that holds various elements, such as titles, icons, and actions, usually placed at the top of the screen. It typically consists of:</p><ul><li><strong>Title</strong>: The main text of the screen.</li><li><strong>Actions</strong>: Icons that are placed on the right side (like search, settings, etc.).</li><li><strong>Leading</strong>: Usually a back button or a menu button (like the hamburger menu)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/0*QUsMWy-j6XtCuO2R" /></figure><pre>import &#39;package:flutter/material.dart&#39;;<br><br>void main() {<br>  runApp(MyApp());<br>}<br><br>class MyApp extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      home: Scaffold(<br>        appBar: AppBar(<br>          title: Text(&#39;App Bar Example&#39;),<br>          actions: &lt;Widget&gt;[<br>            IconButton(<br>              icon: Icon(Icons.settings),<br>              onPressed: () {<br>                print(&#39;Settings pressed&#39;);<br>              },<br>            ),<br>          ],<br>        ),<br>        body: Center(<br>          child: Text(&#39;Hello, Flutter!&#39;),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>In this example, the <strong>AppBar</strong> has a title and an action icon for settings. It’s a simple setup that works for most standard apps.</p><h4>Customizing the App Bar</h4><p>Flutter provides many customization options for the App Bar, such as changing its background color, elevation, and even adding a flexible space for animations.</p><p><em>Example with a custom background color and elevation</em></p><pre>appBar: AppBar(<br>  title: Text(&#39;Custom App Bar&#39;),<br>  backgroundColor: Colors.teal,<br>  elevation: 10,<br>)</pre><p>This example customizes the <strong>App Bar</strong> by changing its background color to teal and giving it a shadow with the elevation property.</p><h4>What is a Transparent App Bar?</h4><p>A <strong>Transparent App Bar</strong> allows the content beneath it (like images, videos, or background color) to be visible through the bar. It is particularly useful when you want a modern design that feels immersive.</p><p>To create a <strong>Transparent App Bar</strong>, we need to use the transparent property and make the background color of the App Bar fully transparent.</p><pre>import &#39;package:flutter/material.dart&#39;;<br><br>void main() {<br>  runApp(MyApp());<br>}<br><br>class MyApp extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      home: Scaffold(<br>        appBar: AppBar(<br>          title: Text(&#39;Transparent App Bar&#39;),<br>          backgroundColor: Colors.transparent,<br>          elevation: 0,<br>        ),<br>        body: Stack(<br>          children: [<br>            Image.network(<br>              &#39;https://example.com/your-image.jpg&#39;,<br>              fit: BoxFit.cover,<br>              width: double.infinity,<br>              height: double.infinity,<br>            ),<br>            Center(child: Text(&#39;Your Content Here&#39;, style: TextStyle(fontSize: 24, color: Colors.white))),<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>we set the <strong>backgroundColor</strong> to Colors.transparent and set the <strong>elevation</strong> to 0 to remove the shadow. The content below the <strong>AppBar</strong> (a full-screen image) is visible through it.</p><h4>Use Cases for Transparent App Bars</h4><ol><li><strong>Hero Images</strong>:- Transparent App Bars work great for apps that use large background images (e.g., on home screens or landing pages).</li><li><strong>Branding and Customization</strong>:- If you want the background of your app to match the branding or colors of your images, transparent App Bars allow a seamless look.</li><li><strong>Immersive Experiences</strong>:- For apps that require full-screen or immersive user experiences, like media apps or travel apps, a transparent App Bar can provide a clean design.</li></ol><p>Understanding and using the <strong>App Bar</strong> and <strong>Transparent App Bar</strong> in Flutter is an excellent way to elevate your app’s user interface. Whether you’re building a simple app or aiming for a sleek, modern design, these components offer versatility and flexibility. 🌟</p><ul><li>The <strong>App Bar</strong> 🏙️ is perfect for standard navigation and displaying key app elements like titles, icons, and actions.</li><li>The <strong>Transparent App Bar</strong> 🌈 is ideal for creating immersive and visually appealing interfaces that allow your content to shine through. 🌿</li></ul><p>Both components are easy to customize and can be adapted to fit various design needs. With just a few lines of code, you can create stunning UIs that make your app stand out. 💻🚀</p><p>Give these <strong>App Bar</strong> and <strong>Transparent App Bar</strong> techniques a try in your own Flutter projects! Don’t forget to share your designs and experiences with us in the comments below. 💬 Let’s keep creating amazing apps together! 👩‍💻👨‍💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16ff4268f1ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create an Onboarding Page in Flutter]]></title>
            <link>https://medium.com/@charuthajanith/how-to-create-an-onboarding-page-in-flutter-4194a153102c?source=rss-19d4675ecd70------2</link>
            <guid isPermaLink="false">https://medium.com/p/4194a153102c</guid>
            <dc:creator><![CDATA[Janith Charutha]]></dc:creator>
            <pubDate>Tue, 17 Dec 2024 10:22:31 GMT</pubDate>
            <atom:updated>2024-12-17T10:22:31.793Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j05ggm8EBIlOxDl2urPTpQ.png" /></figure><p>In modern mobile applications, <strong>onboarding screens</strong> serve as the first impression for users. They help introduce your app, explain its features, and guide users through the initial setup. In this tutorial, we will walk you through creating a simple <strong>Onboarding Screen</strong> in Flutter with multiple pages, showcasing its implementation using main.dart, onboarding.dart, and homepage.dart.</p><p><strong><em>Let’s get started</em></strong>🚀<strong><em>!</em></strong></p><h4>1. Adding Assets</h4><p>Make sure you have onboarding images to display. Create an assets folder in the root of your project and place your images (like onboarding_1.png, onboarding_2.png, onboarding_3.png) inside it.</p><pre>flutter:<br>  assets:<br>    - assets/onboarding_1.png<br>    - assets/onboarding_2.png<br>    - assets/onboarding_3.png</pre><h4>2. dependencies</h4><p>To use the smooth_page_indicator package, you need to add it to your pubspec.yaml file.</p><pre>dependencies:<br>  flutter:<br>    sdk: flutter<br>  smooth_page_indicator: ^1.2.0+3</pre><h4>3. Setting up the main.dart File</h4><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;onboarding.dart&#39;; // Import HomePage if needed later<br><br>void main() {<br>  runApp(MyApp());<br>}<br><br>class MyApp extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      debugShowCheckedModeBanner: false,<br>      title: &#39;TaskMate&#39;,<br>      theme: ThemeData(<br>        primarySwatch: Colors.blue,<br>        visualDensity: VisualDensity.adaptivePlatformDensity,<br>      ),<br>      home: Onbording(), // Directly show Onboarding screen<br>    );<br>  }<br>}</pre><h4>4. Creating the homepage.dart File</h4><pre>import &#39;package:flutter/material.dart&#39;;<br><br>class HomePage extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(<br>        title: Text(&#39;Home Page&#39;),<br>      ),<br>      body: Center(<br>        child: Text(<br>          &#39;Welcome to the Home Page!&#39;,<br>          style: TextStyle(fontSize: 24),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><h4>5. Creating the onboarding.dart File</h4><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:smooth_page_indicator/smooth_page_indicator.dart&#39;;<br><br>import &#39;homepage.dart&#39;;<br><br><br>class Onbording extends StatefulWidget {<br>  const Onbording({Key? key}) : super(key: key);<br><br>  @override<br>  State&lt;Onbording&gt; createState() =&gt; _OnbordingState();<br>}<br><br>class _OnbordingState extends State&lt;Onbording&gt; {<br>  final controller = PageController();<br>  bool isLastPage = false;<br><br>  @override<br>  void dispose() {<br>    controller.dispose();<br>    super.dispose();<br>  }<br><br>  Widget build(BuildContext context) {<br>    return SafeArea(<br>      child: Scaffold(<br>        body: Container(<br>          padding: EdgeInsets.only(bottom: 10.0),<br>          child: PageView(<br>            controller: controller,<br>            onPageChanged: (index) {<br>              setState(() {<br>                isLastPage = index == 2;<br>              });<br>            },<br>            children: [<br>              // Page 1<br>              Container(<br>                child: Column(<br>                  mainAxisAlignment: MainAxisAlignment.center,<br>                  children: [<br>                    Image.asset(&#39;onloading1.jpg&#39;, fit: BoxFit.cover, width: double.infinity),<br>                    SizedBox(height: 30.0),<br>                    Text(&#39;Welcome to TaskMate&#39;, style: TextStyle(fontSize: 32, fontWeight: FontWeight.bold)),<br>                    SizedBox(height: 25.0),<br>                  ],<br>                ),<br>              ),<br>              // Page 2<br>              SingleChildScrollView(<br>                child: Column(<br>                  mainAxisAlignment: MainAxisAlignment.center,<br>                  children: [<br>                    Image.asset(&#39;onloading2.jpg&#39;, fit: BoxFit.cover, width: double.infinity),<br>                    SizedBox(height: 20.0),<br>                    Text(&#39;Manage Your Workday&#39;, style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold)),<br>                    SizedBox(height: 25.0),<br>                    Column(<br>                      children: [<br>                        Center(child: Text(&#39;The TaskMate application will be your best friend and reminder for your daily tasks.&#39;)),<br>                        SizedBox(height: 70),<br>                      ],<br>                    ),<br>                  ],<br>                ),<br>              ),<br>              // Page 3<br>              Container(<br>                child: Column(<br>                  mainAxisAlignment: MainAxisAlignment.center,<br>                  children: [<br>                    Image.asset(&#39;onloading3.jpg&#39;, fit: BoxFit.cover, width: double.infinity),<br>                    SizedBox(height: 60.0),<br>                  ],<br>                ),<br>              ),<br>            ],<br>          ),<br>        ),<br>        bottomSheet: isLastPage<br>            ? TextButton(<br>          style: TextButton.styleFrom(<br>            shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),<br>            foregroundColor: Colors.white,<br>            backgroundColor: Colors.cyan[300],<br>            minimumSize: Size.fromHeight(70.0),<br>          ),<br>          child: Text(&#39;Get Started&#39;, style: TextStyle(fontSize: 23.0)),<br>          onPressed: () async {<br>            Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (context) =&gt;<br>                HomePage()<br>            ));<br>          },<br>        )<br>            : Container(<br>          padding: EdgeInsets.symmetric(horizontal: 20.0),<br>          height: 60.0,<br>          color: Colors.cyan[100],<br>          child: Row(<br>            mainAxisAlignment: MainAxisAlignment.spaceBetween,<br>            children: [<br>              TextButton(<br>                onPressed: () {<br>                  controller.jumpToPage(2);<br>                },<br>                child: Text(&#39;SKIP&#39;, style: TextStyle(color: Colors.black, fontSize: 23)),<br>              ),<br>              Center(<br>                child: SmoothPageIndicator(<br>                  controller: controller,<br>                  count: 3,<br>                ),<br>              ),<br>              TextButton(<br>                onPressed: () {<br>                  controller.nextPage(duration: Duration(microseconds: 500), curve: Curves.easeInOut);<br>                },<br>                child: Text(&#39;NEXT&#39;, style: TextStyle(color: Colors.black, fontSize: 23)),<br>              ),<br>            ],<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><h4>Running the App!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*3Zk_S1QVddYKlDEBCrlWtA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*_ezmpy9j_41GzZT0FrwBIw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*4yLmUZV9-_WKthpVKsKPCg.png" /></figure><p>Happy coding and enjoy building amazing onboarding screens in your Flutter app! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4194a153102c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Essential Flutter Widgets: A Beginner’s Guide ]]></title>
            <link>https://medium.com/@charuthajanith/mastering-essential-flutter-widgets-a-beginners-guide-eec1f79e08c5?source=rss-19d4675ecd70------2</link>
            <guid isPermaLink="false">https://medium.com/p/eec1f79e08c5</guid>
            <dc:creator><![CDATA[Janith Charutha]]></dc:creator>
            <pubDate>Mon, 16 Dec 2024 06:07:32 GMT</pubDate>
            <atom:updated>2024-12-16T06:11:31.264Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dDyIQHttrF21SDt3.png" /></figure><p>Flutter is a powerful framework for building beautiful, natively compiled applications for mobile, web, and desktop. If you’re a beginner, mastering <strong>Flutter widgets</strong> is crucial to elevate your app-building skills.</p><p>In this guide, I’ll walk you through essential Flutter components like SnackBar, Toast, Bottom Navigation, Drawer, and more. Each component is explained with examples and best practices so you can start implementing them in your projects.</p><h4>1. SnackBar &amp; Toast</h4><h4>SnackBar</h4><p>SnackBar is a widget that provides lightweight feedback about an operation.</p><pre>ScaffoldMessenger.of(context).showSnackBar(<br>  SnackBar(<br>    content: Text(&#39;This is a SnackBar&#39;),<br>    action: SnackBarAction(<br>      label: &#39;Undo&#39;,<br>      onPressed: () {<br>        // Perform some action<br>      },<br>    ),<br>  ),<br>);</pre><h4>Toast</h4><pre>import &#39;package:fluttertoast/fluttertoast.dart&#39;;<br><br>Fluttertoast.showToast(<br>  msg: &quot;This is a Toast message&quot;,<br>  toastLength: Toast.LENGTH_SHORT,<br>  gravity: ToastGravity.BOTTOM,<br>);</pre><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:fluttertoast/fluttertoast.dart&#39;;<br><br>void main() =&gt; runApp(ToastExample());<br><br>class ToastExample extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      home: Scaffold(<br>        appBar: AppBar(title: Text(&#39;Toast Example&#39;)),<br>        body: Center(<br>          child: ElevatedButton(<br>            onPressed: () {<br>              Fluttertoast.showToast(<br>                msg: &quot;This is a Toast message&quot;,<br>                toastLength: Toast.LENGTH_SHORT,<br>                gravity: ToastGravity.BOTTOM,<br>                backgroundColor: Colors.grey,<br>                textColor: Colors.white,<br>              );<br>            },<br>            child: Text(&#39;Show Toast&#39;),<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><h4>2. Bottom Navigation Bar</h4><p>BottomNavigationBar allows easy navigation between views.</p><pre>BottomNavigationBar(<br>  items: const [<br>    BottomNavigationBarItem(icon: Icon(Icons.home), label: &#39;Home&#39;),<br>    BottomNavigationBarItem(icon: Icon(Icons.search), label: &#39;Search&#39;),<br>  ],<br>  currentIndex: 0, // Active index<br>  onTap: (index) {<br>    // Handle tab switching<br>  },<br>);</pre><h4>3. Drawer</h4><p>Drawer is used to create side navigation.</p><pre>Drawer(<br>  child: ListView(<br>    children: [<br>      DrawerHeader(child: Text(&#39;Header&#39;)),<br>      ListTile(title: Text(&#39;Item 1&#39;), onTap: () {}),<br>      ListTile(title: Text(&#39;Item 2&#39;), onTap: () {}),<br>    ],<br>  ),<br>);</pre><h4>4. Popup Menu</h4><p>A PopupMenuButton creates overflow menus.</p><pre>PopupMenuButton&lt;String&gt;(<br>  onSelected: (value) {<br>    print(value);<br>  },<br>  itemBuilder: (context) =&gt; [<br>    PopupMenuItem(value: &#39;Option 1&#39;, child: Text(&#39;Option 1&#39;)),<br>    PopupMenuItem(value: &#39;Option 2&#39;, child: Text(&#39;Option 2&#39;)),<br>  ],<br>);</pre><h4>5. Radio Button</h4><p>Used to select one option among many.</p><pre>int selectedValue = 1;<br><br>Column(<br>  children: [<br>    Radio&lt;int&gt;(<br>      value: 1,<br>      groupValue: selectedValue,<br>      onChanged: (value) {<br>        setState(() =&gt; selectedValue = value!);<br>      },<br>    ),<br>    Radio&lt;int&gt;(<br>      value: 2,<br>      groupValue: selectedValue,<br>      onChanged: (value) {<br>        setState(() =&gt; selectedValue = value!);<br>      },<br>    ),<br>  ],<br>);</pre><h4>6. Switch Button</h4><p>A toggle button to switch between true/false states.</p><pre>bool isSwitched = false;<br><br>Switch(<br>  value: isSwitched,<br>  onChanged: (value) {<br>    setState(() =&gt; isSwitched = value);<br>  },<br>);</pre><h4>7. CheckBox</h4><p>A widget to toggle between checked and unchecked.</p><pre>bool isChecked = false;<br><br>Checkbox(<br>  value: isChecked,<br>  onChanged: (value) {<br>    setState(() =&gt; isChecked = value!);<br>  },<br>);</pre><h4>8. Alert Dialog</h4><p>For displaying confirmation or warning messages.</p><pre>showDialog(<br>  context: context,<br>  builder: (context) =&gt; AlertDialog(<br>    title: Text(&#39;Alert&#39;),<br>    content: Text(&#39;This is an alert dialog.&#39;),<br>    actions: [<br>      TextButton(onPressed: () =&gt; Navigator.pop(context), child: Text(&#39;Cancel&#39;)),<br>      TextButton(onPressed: () {}, child: Text(&#39;OK&#39;)),<br>    ],<br>  ),<br>);</pre><h4>9. Card</h4><p>Card is used for displaying content with a shadow effect.</p><pre>Card(<br>  elevation: 5,<br>  child: Padding(<br>    padding: const EdgeInsets.all(8.0),<br>    child: Text(&#39;This is a Card&#39;),<br>  ),<br>);</pre><h4>10. DropDown Button</h4><p>Used for selecting one value from a list.</p><pre>String dropdownValue = &#39;One&#39;;<br><br>DropdownButton&lt;String&gt;(<br>  value: dropdownValue,<br>  items: [&#39;One&#39;, &#39;Two&#39;, &#39;Three&#39;]<br>      .map((value) =&gt; DropdownMenuItem(value: value, child: Text(value)))<br>      .toList(),<br>  onChanged: (newValue) {<br>    setState(() =&gt; dropdownValue = newValue!);<br>  },<br>);</pre><h4>11. Modal Bottom Sheet</h4><p>A sliding panel that comes from the bottom.</p><pre>showModalBottomSheet(<br>  context: context,<br>  builder: (context) =&gt; Column(<br>    mainAxisSize: MainAxisSize.min,<br>    children: [<br>      ListTile(title: Text(&#39;Option 1&#39;), onTap: () {}),<br>      ListTile(title: Text(&#39;Option 2&#39;), onTap: () {}),<br>    ],<br>  ),<br>);</pre><p>By mastering these Flutter components, you’ll enhance the functionality and usability of your apps. Whether it’s navigation with a Drawer, displaying a quick SnackBar, or adding interactivity with Switch or CheckBox, these widgets are essential building blocks for every developer.</p><h3>If you found this guide helpful, don’t forget to share and give it a 👏!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eec1f79e08c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Flutter Widgets: A Beginner’s Guide ]]></title>
            <link>https://medium.com/@charuthajanith/mastering-flutter-widgets-a-beginners-guide-adc1acec2d0b?source=rss-19d4675ecd70------2</link>
            <guid isPermaLink="false">https://medium.com/p/adc1acec2d0b</guid>
            <dc:creator><![CDATA[Janith Charutha]]></dc:creator>
            <pubDate>Sun, 15 Dec 2024 07:59:37 GMT</pubDate>
            <atom:updated>2024-12-15T07:59:37.518Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RFq8h0dvOUE8LQte.jpg" /></figure><p>Flutter is revolutionizing mobile app development with its beautiful and flexible user interface framework. At the heart of Flutter lies the concept of <strong>widgets</strong>. Whether you’re a beginner or someone looking to sharpen your Flutter skills, understanding widgets is the first step toward creating stunning mobile apps.</p><p>In this guide, we’ll cover the essential widgets in Flutter, including <strong>Stateless</strong> and <strong>Stateful Widgets</strong>, layout widgets like <strong>Rows, Columns, Flexible, Expanded, Stack, Positioned</strong>, and some essential UI components like <strong>ListView</strong> and <strong>GridView</strong>.</p><h4>What is a Widget in Flutter?</h4><p>In Flutter, <strong>everything is a widget.</strong><br>A widget is a building block of your app’s user interface. It can represent:</p><ul><li><strong>Visual elements</strong> like text, buttons, or images.</li><li><strong>Structural elements</strong> like rows, columns, and grids.</li><li><strong>Interactive elements</strong> like forms and input fields.</li></ul><p>Widgets are either <strong>Stateless</strong> (don’t change) or <strong>Stateful</strong> (can change dynamically).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*go2BNvbOiqi_YrFj" /></figure><h4>Stateless Widget</h4><p>A <strong>StatelessWidget</strong> is immutable, meaning it doesn’t change over time. Use it when the UI does not depend on any dynamic data.</p><h4>Stateful Widget</h4><p>A <strong>StatefulWidget</strong> can hold a state that changes dynamically, like user inputs, animations, or API data updates.</p><h4>MaterialApp Widget in Flutter</h4><p>The MaterialApp widget is the root of any Flutter app. It provides essential configurations like:</p><ul><li><strong>App title</strong></li><li><strong>Theme</strong></li><li><strong>Navigation</strong></li></ul><pre>import &#39;package:flutter/material.dart&#39;;<br><br>void main() {<br>  runApp(MaterialApp(<br>    title: &quot;My App&quot;,<br>    home: Scaffold(body: Center(child: Text(&quot;Hello World!&quot;))),<br>  ));<br>}</pre><h4>Scaffold Widget in Flutter</h4><p>The Scaffold widget is the backbone of the app’s layout. It provides essential UI components like:</p><ul><li><strong>AppBar</strong></li><li><strong>Drawer</strong></li><li><strong>FloatingActionButton</strong></li></ul><pre>import &#39;package:flutter/material.dart&#39;;<br><br>void main() {<br>  runApp(MaterialApp(<br>    home: Scaffold(<br>      appBar: AppBar(title: Text(&quot;Scaffold Example&quot;)),<br>      body: Center(child: Text(&quot;Welcome to Flutter!&quot;)),<br>      floatingActionButton: FloatingActionButton(onPressed: () {}, child: Icon(Icons.add)),<br>    ),<br>  ));<br>}</pre><h4>Rows &amp; Columns</h4><p>Rows and columns are fundamental for creating responsive layouts.</p><ul><li><strong>Row</strong>: Arranges children horizontally.</li><li><strong>Column</strong>: Arranges children vertically.</li></ul><pre>import &#39;package:flutter/material.dart&#39;;<br><br>void main() {<br>  runApp(MaterialApp(<br>    home: Scaffold(<br>      appBar: AppBar(title: Text(&quot;Scaffold Example&quot;)),<br>      body: Column(<br>        mainAxisAlignment: MainAxisAlignment.spaceEvenly,<br>        children: [<br>          Row(<br>            mainAxisAlignment: MainAxisAlignment.spaceEvenly,<br>            children: [<br>              Container(<br>                padding: EdgeInsets.all(10),<br>                decoration: BoxDecoration(<br>                  color: Colors.blue,<br>                  borderRadius: BorderRadius.circular(8),<br>                ),<br>                child: Text(&quot;Item 1&quot;, style: TextStyle(color: Colors.white)),<br>              ),<br>              Container(<br>                padding: EdgeInsets.all(10),<br>                decoration: BoxDecoration(<br>                  color: Colors.green,<br>                  borderRadius: BorderRadius.circular(8),<br>                ),<br>                child: Text(&quot;Item 2&quot;, style: TextStyle(color: Colors.white)),<br>              ),<br>              Container(<br>                padding: EdgeInsets.all(10),<br>                decoration: BoxDecoration(<br>                  color: Colors.red,<br>                  borderRadius: BorderRadius.circular(8),<br>                ),<br>                child: Text(&quot;Item 3&quot;, style: TextStyle(color: Colors.white)),<br>              ),<br>            ],<br>          ),<br>          Column(<br>            mainAxisAlignment: MainAxisAlignment.spaceEvenly,<br>            children: [<br>              Container(<br>                padding: EdgeInsets.all(10),<br>                margin: EdgeInsets.symmetric(vertical: 5),<br>                decoration: BoxDecoration(<br>                  color: Colors.purple,<br>                  borderRadius: BorderRadius.circular(8),<br>                ),<br>                child: Text(&quot;Item A&quot;, style: TextStyle(color: Colors.white)),<br>              ),<br>              Container(<br>                padding: EdgeInsets.all(10),<br>                margin: EdgeInsets.symmetric(vertical: 5),<br>                decoration: BoxDecoration(<br>                  color: Colors.orange,<br>                  borderRadius: BorderRadius.circular(8),<br>                ),<br>                child: Text(&quot;Item B&quot;, style: TextStyle(color: Colors.white)),<br>              ),<br>              Container(<br>                padding: EdgeInsets.all(10),<br>                margin: EdgeInsets.symmetric(vertical: 5),<br>                decoration: BoxDecoration(<br>                  color: Colors.teal,<br>                  borderRadius: BorderRadius.circular(8),<br>                ),<br>                child: Text(&quot;Item C&quot;, style: TextStyle(color: Colors.white)),<br>              ),<br>            ],<br>          ),<br>        ],<br>      ),<br>    ),<br>  ));<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*ghQDRRX5MJWCTmaYQHTdrg.png" /></figure><h4>Flexible &amp; Expanded</h4><p>These widgets help manage layout sizes within a row or column.</p><ul><li><strong>Flexible</strong>: Allocates available space proportionally.</li><li><strong>Expanded</strong>: Forces the child to take all remaining space.</li></ul><pre>import &#39;package:flutter/material.dart&#39;;<br><br>void main() {<br>  runApp(MaterialApp(<br>    home: Scaffold(<br>      appBar: AppBar(title: Text(&quot;Expanded Row Example&quot;)),<br>      body: Center(<br>        child: Row(<br>          children: [<br>            Expanded(<br>              child: Container(<br>                color: Colors.blue,<br>                padding: EdgeInsets.all(10),<br>                child: Text(<br>                  &quot;Left&quot;,<br>                  textAlign: TextAlign.center,<br>                  style: TextStyle(color: Colors.white, fontSize: 18),<br>                ),<br>              ),<br>            ),<br>            Expanded(<br>              child: Container(<br>                color: Colors.green,<br>                padding: EdgeInsets.all(10),<br>                child: Text(<br>                  &quot;Right&quot;,<br>                  textAlign: TextAlign.center,<br>                  style: TextStyle(color: Colors.white, fontSize: 18),<br>                ),<br>              ),<br>            ),<br>          ],<br>        ),<br>      ),<br>    ),<br>  ));<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*BW_mTMHuajiv-XnTWH4QGA.png" /></figure><h4>ListView &amp; GridView</h4><ul><li><strong>ListView</strong>: Displays scrollable lists.</li></ul><pre>import &#39;package:flutter/material.dart&#39;;<br><br>void main() {<br>  runApp(MaterialApp(<br>    home: Scaffold(<br>      appBar: AppBar(title: Text(&quot;ListView with Tiles&quot;)),<br>      body: ListView(<br>        children: [<br>          Card(<br>            shape: RoundedRectangleBorder(<br>              borderRadius: BorderRadius.circular(10),<br>            ),<br>            child: ListTile(<br>              leading: Icon(Icons.home, color: Colors.blue),<br>              title: Text(&quot;Home&quot;),<br>              subtitle: Text(&quot;Go to home page&quot;),<br>              trailing: Icon(Icons.arrow_forward, color: Colors.grey),<br>              onTap: () {<br>                // Handle tap action<br>              },<br>            ),<br>          ),<br>          Card(<br>            shape: RoundedRectangleBorder(<br>              borderRadius: BorderRadius.circular(10),<br>            ),<br>            child: ListTile(<br>              leading: Icon(Icons.settings, color: Colors.green),<br>              title: Text(&quot;Settings&quot;),<br>              subtitle: Text(&quot;Change app settings&quot;),<br>              trailing: Icon(Icons.arrow_forward, color: Colors.grey),<br>              onTap: () {<br>                // Handle tap action<br>              },<br>            ),<br>          ),<br>          Card(<br>            shape: RoundedRectangleBorder(<br>              borderRadius: BorderRadius.circular(10),<br>            ),<br>            child: ListTile(<br>              leading: Icon(Icons.info, color: Colors.red),<br>              title: Text(&quot;About&quot;),<br>              subtitle: Text(&quot;Learn more about this app&quot;),<br>              trailing: Icon(Icons.arrow_forward, color: Colors.grey),<br>              onTap: () {<br>                // Handle tap action<br>              },<br>            ),<br>          ),<br>        ],<br>      ),<br>    ),<br>  ));<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*64JRM3AWFobLpvUC6_t-NQ.png" /></figure><ul><li><strong>GridView</strong>: Displays scrollable grids.</li></ul><pre>import &#39;package:flutter/material.dart&#39;;<br><br>void main() {<br>  runApp(MaterialApp(<br>    home: Scaffold(<br>      appBar: AppBar(title: Text(&quot;GridView Example&quot;)),<br>      body: GridView.count(<br>        crossAxisCount: 2, // Number of columns<br>        crossAxisSpacing: 10, // Space between columns<br>        mainAxisSpacing: 10, // Space between rows<br>        padding: EdgeInsets.all(10),<br>        children: [<br>          Card(<br>            color: Colors.blue,<br>            shape: RoundedRectangleBorder(<br>              borderRadius: BorderRadius.circular(10),<br>            ),<br>            child: Center(<br>              child: Text(<br>                &quot;Grid 1&quot;,<br>                style: TextStyle(fontSize: 20, color: Colors.white),<br>              ),<br>            ),<br>          ),<br>          Card(<br>            color: Colors.green,<br>            shape: RoundedRectangleBorder(<br>              borderRadius: BorderRadius.circular(10),<br>            ),<br>            child: Center(<br>              child: Text(<br>                &quot;Grid 2&quot;,<br>                style: TextStyle(fontSize: 20, color: Colors.white),<br>              ),<br>            ),<br>          ),<br>          Card(<br>            color: Colors.red,<br>            shape: RoundedRectangleBorder(<br>              borderRadius: BorderRadius.circular(10),<br>            ),<br>            child: Center(<br>              child: Text(<br>                &quot;Grid 3&quot;,<br>                style: TextStyle(fontSize: 20, color: Colors.white),<br>              ),<br>            ),<br>          ),<br>          Card(<br>            color: Colors.orange,<br>            shape: RoundedRectangleBorder(<br>              borderRadius: BorderRadius.circular(10),<br>            ),<br>            child: Center(<br>              child: Text(<br>                &quot;Grid 4&quot;,<br>                style: TextStyle(fontSize: 20, color: Colors.white),<br>              ),<br>            ),<br>          ),<br>        ],<br>      ),<br>    ),<br>  ));<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*Pz1x06Y3uM1GfSyWGMtMOg.png" /></figure><p>Flutter <strong>widgets</strong> are the foundation of any mobile app. By mastering widgets like Stateless and Stateful, understanding layout widgets like Rows, Columns, Flexible, and exploring ListView or GridView, you can create stunning and dynamic UIs.</p><p>Next, we’ll dive into <strong>animations and navigation</strong> in Flutter to make your apps even more engaging. Stay tuned for more insights into Flutter development! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=adc1acec2d0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>