<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Aadarsh Kunwar</title>
    <description>The latest articles on Forem by Aadarsh Kunwar (@aadarshk7).</description>
    <link>https://forem.com/aadarshk7</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1719209%2Fe5d07def-7e1b-4cf4-a914-1e07539589e0.jpeg</url>
      <title>Forem: Aadarsh Kunwar</title>
      <link>https://forem.com/aadarshk7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/aadarshk7"/>
    <language>en</language>
    <item>
      <title>What's going on here</title>
      <dc:creator>Aadarsh Kunwar</dc:creator>
      <pubDate>Tue, 24 Feb 2026 11:12:41 +0000</pubDate>
      <link>https://forem.com/aadarshk7/whats-going-on-here-162a</link>
      <guid>https://forem.com/aadarshk7/whats-going-on-here-162a</guid>
      <description>&lt;p&gt;Newwww&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Hello Guys back after almost 8 months</title>
      <dc:creator>Aadarsh Kunwar</dc:creator>
      <pubDate>Wed, 06 Aug 2025 05:27:44 +0000</pubDate>
      <link>https://forem.com/aadarshk7/hello-guys-back-after-almost-8-months-4c72</link>
      <guid>https://forem.com/aadarshk7/hello-guys-back-after-almost-8-months-4c72</guid>
      <description>&lt;p&gt;Now i'll rise again&lt;/p&gt;

</description>
      <category>aadarsh</category>
      <category>is</category>
      <category>back</category>
    </item>
    <item>
      <title>What's new in Flutter 3.27</title>
      <dc:creator>Aadarsh Kunwar</dc:creator>
      <pubDate>Thu, 19 Dec 2024 10:29:41 +0000</pubDate>
      <link>https://forem.com/aadarshk7/whats-new-in-flutter-327-6ba</link>
      <guid>https://forem.com/aadarshk7/whats-new-in-flutter-327-6ba</guid>
      <description>&lt;p&gt;🦋 Impeller is now the default on Vulkan-enabled Android devices&lt;br&gt;
🍏 Improvements to Cupertino widget fidelity&lt;br&gt;
🛠 New DevTools Inspector&lt;br&gt;
and more!&lt;/p&gt;

&lt;p&gt;Read the blog → &lt;a href="https://goo.gle/3VAJedw" rel="noopener noreferrer"&gt;https://goo.gle/3VAJedw&lt;/a&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>coding</category>
      <category>programming</category>
      <category>dev</category>
    </item>
    <item>
      <title>Top 10 flutter interview questions</title>
      <dc:creator>Aadarsh Kunwar</dc:creator>
      <pubDate>Fri, 25 Oct 2024 05:52:57 +0000</pubDate>
      <link>https://forem.com/aadarshk7/top-10-flutter-interview-questions-4b44</link>
      <guid>https://forem.com/aadarshk7/top-10-flutter-interview-questions-4b44</guid>
      <description>&lt;ol&gt;
&lt;li&gt;General Flutter Questions
Q: What is Flutter, and how does it differ from other cross-platform development frameworks?
A: Flutter is a UI toolkit by Google for building natively compiled applications for mobile, web, and desktop from a single codebase. Unlike other frameworks that rely on web-based technologies, Flutter uses its own rendering engine, Skia, which allows it to draw every pixel on the screen, providing high performance and a native feel.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Q: What is a widget in Flutter? Differentiate between Stateless and Stateful Widgets.&lt;br&gt;
A: In Flutter, everything is a widget, which is a basic building block for UI components. StatelessWidget is immutable and does not change once it's built. StatefulWidget maintains a mutable state and can change during the app's lifetime, allowing for dynamic UI updates.&lt;/p&gt;

&lt;p&gt;Q: What is BuildContext, and how does it work in Flutter?&lt;br&gt;
A: BuildContext is a handle to the location of a widget in the widget tree. It’s used to look up the widget's position, find dependencies, and access the nearest ancestor widgets.&lt;/p&gt;

&lt;p&gt;Q: What are keys in Flutter, and why are they important?&lt;br&gt;
A: Keys are identifiers used to preserve the state of widgets in a list or when widgets change positions. They help Flutter understand which widget instances should be preserved or replaced.&lt;/p&gt;

&lt;p&gt;Q: Explain the concept of hot reload and hot restart. How do they differ?&lt;br&gt;
A: Hot reload updates code changes on the fly without losing the app's current state, which is great for fast UI tweaks. Hot restart resets the app to its initial state by reloading the code completely.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;State Management
Q: What is state management, and why is it important in Flutter?
A: State management refers to handling the state of the app, such as variables that define the UI or data. It's crucial for maintaining and updating the user interface when data changes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Q: What state management solutions have you used?&lt;br&gt;
A: Common state management solutions include Provider, Bloc, Riverpod, GetX, and Redux. Each has its strengths; for example, Provider is simple and integrates well with Flutter, while Bloc offers a more structured pattern with event-based state changes.&lt;/p&gt;

&lt;p&gt;Q: What is a ChangeNotifier, and how does it help in state management?&lt;br&gt;
A: ChangeNotifier is a part of the Flutter SDK that provides a simple way to manage state. It notifies listeners when there's a change in the state, helping widgets rebuild accordingly.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Layout and Widgets
Q: Explain the difference between a Container and a SizedBox.
A: Container is a versatile widget that can have padding, margin, alignment, and decoration, whereas SizedBox is a simpler widget used primarily for giving a fixed size to its child or spacing between widgets.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Q: How do you create a responsive UI in Flutter?&lt;br&gt;
A: Use MediaQuery for screen dimensions, LayoutBuilder for constraints, and Flexible or Expanded widgets to adapt to different screen sizes. Additionally, AspectRatio helps maintain aspect ratios on different devices.&lt;/p&gt;

&lt;p&gt;Q: What are Expanded and Flexible widgets, and how do they work?&lt;br&gt;
A: Both are used to adjust child widgets' space in a Row or Column. Expanded takes up available space proportionally, while Flexible allows a widget to fill the space but can shrink or grow based on the content's needs.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Data Handling and Persistence
Q: How do you make API calls in Flutter? What packages have you used?
A: Use the http package for RESTful API calls. Other packages like dio offer advanced features like interceptors. Use Future and async to handle asynchronous requests.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Q: How would you parse JSON data in Flutter?&lt;br&gt;
A: Use dart:convert to decode JSON into Dart objects using json.decode. For complex JSON, you can use a Model class and factory constructors to parse JSON data.&lt;/p&gt;

&lt;p&gt;Q: What is the difference between Future and Stream in Dart?&lt;br&gt;
A: A Future represents a single value that will be available asynchronously, whereas a Stream is a sequence of values delivered over time.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Asynchronous Programming and Dart Language
Q: How does the asynchronous model in Dart work? Explain Future, async, and await.
A: Dart's asynchronous model uses Future for handling async operations. Use async to mark functions that contain asynchronous code and await to pause execution until the Future completes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Q: What is Isolate in Dart? When would you use it?&lt;br&gt;
A: An Isolate is a separate thread in Dart used for parallelism. Use it for CPU-intensive tasks that can block the main UI thread.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Testing and Debugging
Q: How do you test a Flutter application? What are the types of tests available?
A: Flutter supports unit tests (testing logic), widget tests (testing UI components), and integration tests (testing complete app scenarios). Use packages like flutter_test and mockito.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Q: What are Golden tests, and how are they used in Flutter?&lt;br&gt;
A: Golden tests compare a widget's rendered output to a reference image (a "golden" image). They ensure the UI remains consistent during code changes.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Animations and Customizations
Q: How do you create animations in Flutter? Explain AnimationController and Tween.
A: Use AnimationController to control the animation's duration and lifecycle. Tween defines a value range to animate between. Use AnimatedBuilder or AnimatedWidget to apply the animation to the UI.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Q: What is a Hero animation in Flutter?&lt;br&gt;
A: Hero is a widget that creates a seamless transition between two screens by animating a shared element. It requires matching Hero tags on both source and destination widgets.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Performance Optimization
Q: What are the best practices to optimize performance in a Flutter app?
A: Use const constructors where possible, minimize rebuilds with RepaintBoundary, use ListView.builder for long lists, cache images using CachedNetworkImage, and avoid large widget trees.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Q: What is the RepaintBoundary widget, and how does it help in performance optimization?&lt;br&gt;
A: RepaintBoundary reduces the repaint area when the widget changes. It helps isolate the widget so that only the specified widget is rebuilt instead of the entire screen.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigation and Architecture
Q: How do you implement navigation in Flutter? What are the different navigation methods?
A: Use Navigator.push for basic navigation, Navigator.pushNamed for named routes, and Navigator 2.0 for complex routing scenarios with state-based navigation.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Q: Explain various Flutter architectural patterns you've worked with.&lt;br&gt;
A: MVC, MVP, and MVVM are classic patterns for organizing code. Clean Architecture emphasizes separation of concerns, with data, domain, and presentation layers.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Advanced Questions
Q: How does Flutter handle rendering under the hood?
A: Flutter uses its Skia rendering engine to draw UI components directly on the screen, bypassing platform-specific UI components. It uses a widget tree, rendering tree, and layer tree for efficient rendering.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Q: How do you handle platform-specific code in Flutter?&lt;br&gt;
A: Use Platform Channels to communicate between Flutter code and native Android or iOS code. This enables accessing native device features or APIs.&lt;/p&gt;

</description>
      <category>coding</category>
      <category>programming</category>
      <category>flutter</category>
      <category>interview</category>
    </item>
    <item>
      <title>Beautiful Animations with CustomPaint in Flutter</title>
      <dc:creator>Aadarsh Kunwar</dc:creator>
      <pubDate>Fri, 25 Oct 2024 05:49:26 +0000</pubDate>
      <link>https://forem.com/aadarshk7/beautiful-animations-with-custompaint-in-flutter-3fli</link>
      <guid>https://forem.com/aadarshk7/beautiful-animations-with-custompaint-in-flutter-3fli</guid>
      <description>&lt;p&gt;I've used CustomPaint to create stunning animations like rotating squares and expanding circles, giving a unique look to Flutter apps. It's a powerful tool for customized UI designs. Check out the full code in my GitHub repo: &lt;a href="https://dev.tourl"&gt;github.com/aadarshk7/flutter_utils&lt;/a&gt; 💻&lt;/p&gt;

&lt;h1&gt;
  
  
  Flutter #CustomPaint #Animations #UI #GitHub
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';
import 'dart:math';

void main() {
  runApp(MaterialApp(
    home: CombinedAnimationScreen(),
  ));
}

class CombinedAnimationScreen extends StatefulWidget {
  @override
  _CombinedAnimationScreenState createState() =&amp;gt;
      _CombinedAnimationScreenState();
}

class _CombinedAnimationScreenState extends State&amp;lt;CombinedAnimationScreen&amp;gt;
    with SingleTickerProviderStateMixin {
  late AnimationController _controller;

  @override
  void initState() {
    super.initState();

    // Initialize the AnimationController
    _controller = AnimationController(
      vsync: this,
      duration: const Duration(seconds: 4),
    )..repeat(reverse: true); // Repeat animation
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        decoration: const BoxDecoration(
          gradient: LinearGradient(
            colors: [Color(0xFF00F260), Color(0xFF0575E6)],
            begin: Alignment.topLeft,
            end: Alignment.bottomRight,
          ),
        ),
        child: Center(
          child: AnimatedBuilder(
            animation: _controller,
            builder: (context, child) {
              return Stack(
                alignment: Alignment.center,
                children: [
                  // Custom paint for the expanding and contracting circles
                  CustomPaint(
                    painter: ExpandingCirclesPainter(_controller.value),
                    child: SizedBox(
                      width: 300,
                      height: 300,
                    ),
                  ),
                  // Custom paint for the rotating square
                  CustomPaint(
                    painter: RotatingSquarePainter(_controller.value),
                    child: SizedBox(
                      width: 150,
                      height: 150,
                    ),
                  ),
                ],
              );
            },
          ),
        ),
      ),
    );
  }
}

class ExpandingCirclesPainter extends CustomPainter {
  final double progress;

  ExpandingCirclesPainter(this.progress);

  @override
  void paint(Canvas canvas, Size size) {
    final center = Offset(size.width / 2, size.height / 2);

    // Gradient paint with fading effect
    final paint = Paint()
      ..style = PaintingStyle.fill
      ..color = Colors.deepPurple.withOpacity(1.0 - progress);

    // Draw multiple expanding circles
    for (int i = 1; i &amp;lt;= 5; i++) {
      final radius = (size.width / 10) * i * progress;
      canvas.drawCircle(center, radius, paint);
    }
  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) {
    return true;
  }
}

class RotatingSquarePainter extends CustomPainter {
  final double progress;

  RotatingSquarePainter(this.progress);

  @override
  void paint(Canvas canvas, Size size) {
    final paint = Paint()
      ..style = PaintingStyle.fill
      ..shader = LinearGradient(
        colors: [Colors.deepPurpleAccent, Colors.orangeAccent, Colors.pink],
        stops: [0.3, 0.6, 1.0],
      ).createShader(Rect.fromLTWH(0, 0, size.width, size.height));

    final center = Offset(size.width / 2, size.height / 2);
    final side = size.width / 2;

    // Apply rotation transformation
    canvas.save();
    canvas.translate(center.dx, center.dy);
    canvas.rotate(2 * pi * progress);
    canvas.translate(-center.dx, -center.dy);

    final rect = Rect.fromCenter(center: center, width: side, height: side);
    canvas.drawRect(rect, paint);

    canvas.restore();
  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) {
    return true;
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>coding</category>
      <category>programming</category>
      <category>flutter</category>
      <category>dart</category>
    </item>
    <item>
      <title>Slider in Flutter</title>
      <dc:creator>Aadarsh Kunwar</dc:creator>
      <pubDate>Fri, 04 Oct 2024 06:35:42 +0000</pubDate>
      <link>https://forem.com/aadarshk7/slider-in-flutter-4mej</link>
      <guid>https://forem.com/aadarshk7/slider-in-flutter-4mej</guid>
      <description>&lt;p&gt;Creating a slider in Flutter is straightforward using the &lt;strong&gt;Slider&lt;/strong&gt; widget. Here’s a simple example that demonstrates how to implement a slider with a label showing the current value:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Slider Example')),
        body: Center(
          child: SliderExample(),
        ),
      ),
    );
  }
}

class SliderExample extends StatefulWidget {
  @override
  _SliderExampleState createState() =&amp;gt; _SliderExampleState();
}

class _SliderExampleState extends State&amp;lt;SliderExample&amp;gt; {
  double _sliderValue = 0.0;

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: &amp;lt;Widget&amp;gt;[
        Slider(
          value: _sliderValue,
          min: 0.0,
          max: 100.0,
          divisions: 10,
          label: _sliderValue.round().toString(),
          onChanged: (double newValue) {
            setState(() {
              _sliderValue = newValue;
            });
          },
        ),
        Text(
          'Slider Value: ${_sliderValue.round()}',
          style: TextStyle(fontSize: 20),
        ),
      ],
    );
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;br&gt;
Slider Widget: The main component used to create the slider.&lt;/p&gt;

&lt;p&gt;value: Current value of the slider.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;min: Minimum value the slider can take.&lt;/li&gt;
&lt;li&gt;max: Maximum value the slider can take.&lt;/li&gt;
&lt;li&gt;divisions: Optional. Specifies the number of discrete divisions in the slider.&lt;/li&gt;
&lt;li&gt;label: Displays the current value of the slider when it’s moved.&lt;/li&gt;
&lt;li&gt;onChanged: A callback that is called whenever the slider value changes.
State Management: The slider value is managed using a stateful widget, allowing the UI to update whenever the slider value changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Text Widget: Displays the current value of the slider beneath it.&lt;/p&gt;

&lt;p&gt;Customizing the Slider&lt;br&gt;
You can customize the appearance of the slider further by adjusting properties like activeColor, inactiveColor, or using a SliderTheme. Here’s a quick example of how to customize the slider’s colors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Slider(
  value: _sliderValue,
  min: 0.0,
  max: 100.0,
  divisions: 10,
  label: _sliderValue.round().toString(),
  activeColor: Colors.blue,
  inactiveColor: Colors.grey,
  onChanged: (double newValue) {
    setState(() {
      _sliderValue = newValue;
    });
  },
)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>flutter</category>
      <category>slider</category>
      <category>coding</category>
      <category>programming</category>
    </item>
    <item>
      <title>Back after a gap because of my exams</title>
      <dc:creator>Aadarsh Kunwar</dc:creator>
      <pubDate>Fri, 04 Oct 2024 06:33:50 +0000</pubDate>
      <link>https://forem.com/aadarshk7/back-after-a-gap-because-of-my-exams-9mf</link>
      <guid>https://forem.com/aadarshk7/back-after-a-gap-because-of-my-exams-9mf</guid>
      <description></description>
      <category>back</category>
    </item>
    <item>
      <title>Flutter Date and Time Picker</title>
      <dc:creator>Aadarsh Kunwar</dc:creator>
      <pubDate>Sun, 15 Sep 2024 16:31:10 +0000</pubDate>
      <link>https://forem.com/aadarshk7/flutter-popupmenubutton-1a4i</link>
      <guid>https://forem.com/aadarshk7/flutter-popupmenubutton-1a4i</guid>
      <description>&lt;p&gt;In Flutter, you can use the built-in &lt;strong&gt;showDatePicker&lt;/strong&gt; and &lt;strong&gt;showTimePicker&lt;/strong&gt; functions to display date and time pickers. Below are examples of how to implement both.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Date Picker&lt;/strong&gt;
You can use showDatePicker to display a date picker dialog and retrieve the selected date.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';

void main() =&amp;gt; runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: DateTimePickerDemo(),
    );
  }
}

class DateTimePickerDemo extends StatefulWidget {
  @override
  _DateTimePickerDemoState createState() =&amp;gt; _DateTimePickerDemoState();
}

class _DateTimePickerDemoState extends State&amp;lt;DateTimePickerDemo&amp;gt; {
  DateTime? selectedDate;

  Future&amp;lt;void&amp;gt; _selectDate(BuildContext context) async {
    final DateTime? pickedDate = await showDatePicker(
      context: context,
      initialDate: DateTime.now(), // Current date
      firstDate: DateTime(2000), // Earliest date
      lastDate: DateTime(2101),  // Latest date
    );

    if (pickedDate != null &amp;amp;&amp;amp; pickedDate != selectedDate)
      setState(() {
        selectedDate = pickedDate;
      });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Date Picker")),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: &amp;lt;Widget&amp;gt;[
            Text(
              selectedDate == null
                  ? 'No date selected!'
                  : 'Selected date: ${selectedDate.toString()}',
            ),
            SizedBox(height: 20),
            ElevatedButton(
              onPressed: () =&amp;gt; _selectDate(context),
              child: Text('Select Date'),
            ),
          ],
        ),
      ),
    );
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Time Picker&lt;/strong&gt;
Similarly, you can use **showTimePicker **to display a time picker dialog.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Future&amp;lt;void&amp;gt; _selectTime(BuildContext context) async {
  final TimeOfDay? pickedTime = await showTimePicker(
    context: context,
    initialTime: TimeOfDay.now(),
  );

  if (pickedTime != null)
    setState(() {
      selectedTime = pickedTime;
    });
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To include both date and time pickers, you can modify the code to add a time picker next to the date picker.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Date and Time Picker Combined&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';

void main() =&amp;gt; runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: DateTimePickerDemo(),
    );
  }
}

class DateTimePickerDemo extends StatefulWidget {
  @override
  _DateTimePickerDemoState createState() =&amp;gt; _DateTimePickerDemoState();
}

class _DateTimePickerDemoState extends State&amp;lt;DateTimePickerDemo&amp;gt; {
  DateTime? selectedDate;
  TimeOfDay? selectedTime;

  Future&amp;lt;void&amp;gt; _selectDate(BuildContext context) async {
    final DateTime? pickedDate = await showDatePicker(
      context: context,
      initialDate: DateTime.now(),
      firstDate: DateTime(2000),
      lastDate: DateTime(2101),
    );
    if (pickedDate != null &amp;amp;&amp;amp; pickedDate != selectedDate)
      setState(() {
        selectedDate = pickedDate;
      });
  }

  Future&amp;lt;void&amp;gt; _selectTime(BuildContext context) async {
    final TimeOfDay? pickedTime = await showTimePicker(
      context: context,
      initialTime: TimeOfDay.now(),
    );
    if (pickedTime != null &amp;amp;&amp;amp; pickedTime != selectedTime)
      setState(() {
        selectedTime = pickedTime;
      });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Date &amp;amp; Time Picker")),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: &amp;lt;Widget&amp;gt;[
            Text(
              selectedDate == null
                  ? 'No date selected!'
                  : 'Selected date: ${selectedDate.toString()}',
            ),
            Text(
              selectedTime == null
                  ? 'No time selected!'
                  : 'Selected time: ${selectedTime.format(context)}',
            ),
            SizedBox(height: 20),
            ElevatedButton(
              onPressed: () =&amp;gt; _selectDate(context),
              child: Text('Select Date'),
            ),
            ElevatedButton(
              onPressed: () =&amp;gt; _selectTime(context),
              child: Text('Select Time'),
            ),
          ],
        ),
      ),
    );
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;showDatePicker&lt;/em&gt;: Opens a date picker and returns the selected date.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;showTimePicker&lt;/em&gt;: Opens a time picker and returns the selected time.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>flutter</category>
      <category>programming</category>
      <category>coding</category>
    </item>
    <item>
      <title>Flutter PopupMenuButton</title>
      <dc:creator>Aadarsh Kunwar</dc:creator>
      <pubDate>Mon, 09 Sep 2024 14:30:46 +0000</pubDate>
      <link>https://forem.com/aadarshk7/flutter-popupmenubutton-3iac</link>
      <guid>https://forem.com/aadarshk7/flutter-popupmenubutton-3iac</guid>
      <description>&lt;p&gt;In Flutter, &lt;strong&gt;PopupMenuButton&lt;/strong&gt; is a widget that provides a menu for selecting among a set of options. When tapped, it displays a list of items in a pop-up that the user can choose from.&lt;/p&gt;

&lt;p&gt;Here’s a basic example of how to use PopupMenuButton:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: PopupMenuExample(),
    );
  }
}

class PopupMenuExample extends StatefulWidget {
  @override
  _PopupMenuExampleState createState() =&amp;gt; _PopupMenuExampleState();
}

class _PopupMenuExampleState extends State&amp;lt;PopupMenuExample&amp;gt; {
  String _selectedOption = 'None';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Popup Menu Button Example'),
        actions: [
          PopupMenuButton&amp;lt;String&amp;gt;(
            onSelected: (String result) {
              setState(() {
                _selectedOption = result;
              });
            },
            itemBuilder: (BuildContext context) =&amp;gt; &amp;lt;PopupMenuEntry&amp;lt;String&amp;gt;&amp;gt;[
              const PopupMenuItem&amp;lt;String&amp;gt;(
                value: 'Option 1',
                child: Text('Option 1'),
              ),
              const PopupMenuItem&amp;lt;String&amp;gt;(
                value: 'Option 2',
                child: Text('Option 2'),
              ),
              const PopupMenuItem&amp;lt;String&amp;gt;(
                value: 'Option 3',
                child: Text('Option 3'),
              ),
            ],
          ),
        ],
      ),
      body: Center(
        child: Text('Selected option: $_selectedOption'),
      ),
    );
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;PopupMenuButton&lt;/em&gt;: Creates a button that shows a pop-up menu.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;onSelected&lt;/em&gt;: Callback that is invoked when an item from the menu is selected.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;PopupMenuItem&lt;/em&gt;: Each item in the pop-up menu with a value and child (usually a Text widget).&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>programming</category>
      <category>coding</category>
    </item>
    <item>
      <title>Flutter DropdownButton</title>
      <dc:creator>Aadarsh Kunwar</dc:creator>
      <pubDate>Fri, 06 Sep 2024 18:11:28 +0000</pubDate>
      <link>https://forem.com/aadarshk7/flutter-dropdownbutton-26f</link>
      <guid>https://forem.com/aadarshk7/flutter-dropdownbutton-26f</guid>
      <description>&lt;p&gt;The &lt;strong&gt;DropdownButton&lt;/strong&gt; widget in Flutter is a convenient way to create a dropdown menu that allows users to select from a list of options. It displays the currently selected item and provides a menu for selecting another item when tapped.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Dropdown Button Example')),
        body: Center(child: DropdownButtonExample()),
      ),
    );
  }
}

class DropdownButtonExample extends StatefulWidget {
  @override
  _DropdownButtonExampleState createState() =&amp;gt; _DropdownButtonExampleState();
}

class _DropdownButtonExampleState extends State&amp;lt;DropdownButtonExample&amp;gt; {
  String? selectedValue;

  @override
  Widget build(BuildContext context) {
    return DropdownButton&amp;lt;String&amp;gt;(
      value: selectedValue,
      hint: Text('Select an option'),
      items: &amp;lt;String&amp;gt;['Option 1', 'Option 2', 'Option 3']
          .map&amp;lt;DropdownMenuItem&amp;lt;String&amp;gt;&amp;gt;((String value) {
        return DropdownMenuItem&amp;lt;String&amp;gt;(
          value: value,
          child: Text(value),
        );
      }).toList(),
      onChanged: (String? newValue) {
        setState(() {
          selectedValue = newValue;
        });
      },
    );
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key Properties of DropdownButton&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;value&lt;/em&gt;: The currently selected item. If it is null, the dropdown will show the hint.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;hint&lt;/em&gt;: A widget that is displayed when no item is selected.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;items&lt;/em&gt;: A list of DropdownMenuItem widgets that represent the options in the dropdown.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;onChanged&lt;/em&gt;: A callback that is called when the user selects an item from the dropdown. It receives the new value as a parameter.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Flutter ListTile</title>
      <dc:creator>Aadarsh Kunwar</dc:creator>
      <pubDate>Tue, 03 Sep 2024 16:48:38 +0000</pubDate>
      <link>https://forem.com/aadarshk7/flutter-listtile-2c01</link>
      <guid>https://forem.com/aadarshk7/flutter-listtile-2c01</guid>
      <description>&lt;p&gt;The &lt;strong&gt;ListTile&lt;/strong&gt; widget in Flutter is a versatile and commonly used widget that allows you to create a row containing a title, subtitle, leading, trailing, and an on-tap action. It's perfect for creating items in a list view, making it easy to add rich, complex lists to your apps.&lt;br&gt;
Here’s a basic example of how to use ListTile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Flutter ListTile Example'),
        ),
        body: ListView(
          children: [
            ListTile(
              leading: Icon(Icons.account_circle),
              title: Text('John Doe'),
              subtitle: Text('Software Engineer'),
              trailing: Icon(Icons.more_vert),
              onTap: () {
                // Action when tapped
                print('Tapped on John Doe');
              },
            ),
            ListTile(
              leading: Icon(Icons.account_circle),
              title: Text('Jane Smith'),
              subtitle: Text('Product Manager'),
              trailing: Icon(Icons.more_vert),
              onTap: () {
                // Action when tapped
                print('Tapped on Jane Smith');
              },
            ),
          ],
        ),
      ),
    );
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Breakdown of ListTile properties:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;leading&lt;/strong&gt;: A widget to display before the title, typically an icon or an avatar.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;title&lt;/strong&gt;: The main text of the tile, often the name or primary information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;subtitle&lt;/strong&gt;: Additional information under the title, usually a description or secondary text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;trailing&lt;/strong&gt;: A widget to display after the title, often used for actions like buttons or icons.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;onTap&lt;/strong&gt;: A callback function that is called when the tile is tapped.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>flutter</category>
      <category>programming</category>
      <category>coding</category>
      <category>dart</category>
    </item>
    <item>
      <title>Aadarsh Kunwar</title>
      <dc:creator>Aadarsh Kunwar</dc:creator>
      <pubDate>Mon, 02 Sep 2024 16:08:25 +0000</pubDate>
      <link>https://forem.com/aadarshk7/aadarsh-kunwar-1987</link>
      <guid>https://forem.com/aadarshk7/aadarsh-kunwar-1987</guid>
      <description></description>
    </item>
  </channel>
</rss>
