<?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 Sandeep Kumar on Medium]]></title>
        <description><![CDATA[Stories by Sandeep Kumar on Medium]]></description>
        <link>https://medium.com/@sandeepkumaredugaon?source=rss-0fc1a07cda66------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*17kVowYgSE5q56g3KbpvfA.png</url>
            <title>Stories by Sandeep Kumar on Medium</title>
            <link>https://medium.com/@sandeepkumaredugaon?source=rss-0fc1a07cda66------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 03:03:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sandeepkumaredugaon/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[Detail Page]]></title>
            <link>https://sandeepkumaredugaon.medium.com/detail-page-2f70d12eec1f?source=rss-0fc1a07cda66------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f70d12eec1f</guid>
            <dc:creator><![CDATA[Sandeep Kumar]]></dc:creator>
            <pubDate>Mon, 21 Jul 2025 09:04:06 GMT</pubDate>
            <atom:updated>2025-07-21T09:04:06.015Z</atom:updated>
            <content:encoded><![CDATA[<pre>import &#39;dart:io&#39;;<br><br>import &#39;package:cached_network_image/cached_network_image.dart&#39;;<br>import &#39;package:car4deal/Views/Screen/HomePage/CarFooter.dart&#39;;<br>import &#39;package:firebase_auth/firebase_auth.dart&#39;;<br>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter/services.dart&#39;;<br>import &#39;package:share_plus/share_plus.dart&#39;;<br>import &#39;package:url_launcher/url_launcher.dart&#39;;<br><br>import &#39;../BuyCar/BookCar.dart&#39;;<br>import &#39;../PhoneAUth/VerifyOtp.dart&#39;;<br><br>class DetailPageCar extends StatelessWidget {<br>  final Map&lt;String, dynamic&gt; carData;<br><br>  const DetailPageCar({super.key, required this.carData});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    final screenWidth = MediaQuery.of(context).size.width;<br>    final isSmallScreen = screenWidth &lt; 360;<br>    final isVerySmallScreen = screenWidth &lt; 320;<br>    final user = FirebaseAuth.instance.currentUser;<br><br>    return Scaffold(<br>      appBar: AppBar(<br>        elevation: 0,<br>        backgroundColor: Colors.white,<br>        actions: [<br>          user == null<br>              ? GestureDetector(<br>            onTap: () {<br>              Navigator.push(<br>                context,<br>                MaterialPageRoute(builder: (context) =&gt; PhoneAuth()),<br>              );<br>            },<br>            child: Container(<br>              margin: const EdgeInsets.only(right: 15),<br>              padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),<br>              decoration: BoxDecoration(<br>                color: const Color(0xFF2C2F33), // Dark theme<br>                borderRadius: BorderRadius.circular(20),<br>              ),<br>              child: const Text(<br>                &quot;Login&quot;,<br>                style: TextStyle(<br>                  color: Colors.white,<br>                  fontWeight: FontWeight.bold,<br>                  fontSize: 14,<br>                ),<br>              ),<br>            ),<br>          )<br>              : Container(<br>            margin: const EdgeInsets.only(right: 15),<br>            padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),<br>            decoration: BoxDecoration(<br>              color: Colors.black54,<br>              borderRadius: BorderRadius.circular(20),<br>            ),<br>            child: Text(<br>              user?.phoneNumber ?? &quot;User&quot;,<br>              style: const TextStyle(<br>                color: Colors.white,<br>                fontWeight: FontWeight.bold,<br>                fontSize: 8,<br>              ),<br>            ),<br>          )        ],<br>        title: SizedBox(<br>          child: Image.asset(<br>            &#39;assets/images/carfodeal.png&#39;,<br>            height: 35,<br>          ),<br>        ),<br>      ),<br><br>      backgroundColor: const Color(0xFFF8F9FA),<br>      body: CustomScrollView(<br>        slivers: [<br>          SliverAppBar(<br>            expandedHeight: isSmallScreen ? 180 : 220,<br>            pinned: true,<br>            backgroundColor: const Color(0xFF1A1A1A),<br>            elevation: 0,<br>            leading: Container(<br>              margin: const EdgeInsets.all(8),<br>              decoration: BoxDecoration(<br>                color: Colors.black.withOpacity(0.6),<br>                borderRadius: BorderRadius.circular(12),<br>              ),<br>              child: IconButton(<br>                icon: const Icon(Icons.arrow_back_ios,<br>                    color: Colors.white, size: 18),<br>                onPressed: () =&gt; Navigator.pop(context),<br>              ),<br>            ),<br>            actions: [<br>              Container(<br>                margin: const EdgeInsets.all(8),<br>                decoration: BoxDecoration(<br>                  color: Colors.black.withOpacity(0.6),<br>                  borderRadius: BorderRadius.circular(12),<br>                ),<br>                child: IconButton(<br>                  icon: const Icon(Icons.favorite_border,<br>                      color: Colors.white, size: 20),<br>                  onPressed: () {<br>                    ScaffoldMessenger.of(context).showSnackBar(<br>                      SnackBar(<br>                        content: const Text(&#39;Added to favorites!&#39;,<br>                            style: TextStyle(color: Colors.white)),<br>                        backgroundColor: Colors.green[600],<br>                        behavior: SnackBarBehavior.floating,<br>                        shape: RoundedRectangleBorder(<br>                            borderRadius: BorderRadius.circular(10)),<br>                        duration: const Duration(seconds: 2),<br>                      ),<br>                    );<br>                  },<br>                ),<br>              ),<br>            ],<br>            flexibleSpace: FlexibleSpaceBar(<br>              background: Stack(<br>                fit: StackFit.expand,<br>                children: [<br>                  CachedNetworkImage(<br>                    imageUrl: carData[&#39;banner_image&#39;]?.toString() ?? &#39;&#39;,<br>                    fit: BoxFit.cover,<br>                    placeholder: (context, url) =&gt; Container(<br>                      decoration: BoxDecoration(<br>                        gradient: LinearGradient(<br>                          colors: [Colors.grey[200]!, Colors.grey[100]!],<br>                          begin: Alignment.topLeft,<br>                          end: Alignment.bottomRight,<br>                        ),<br>                      ),<br>                      child: const Center(<br>                        child: CircularProgressIndicator(<br>                          strokeWidth: 3,<br>                          valueColor:<br>                          AlwaysStoppedAnimation&lt;Color&gt;(Colors.blue),<br>                        ),<br>                      ),<br>                    ),<br>                    errorWidget: (context, url, error) =&gt; Container(<br>                      decoration: BoxDecoration(<br>                        gradient: LinearGradient(<br>                          colors: [Colors.grey[300]!, Colors.grey[200]!],<br>                          begin: Alignment.topLeft,<br>                          end: Alignment.bottomRight,<br>                        ),<br>                      ),<br>                      child: const Center(<br>                        child: Icon(Icons.directions_car,<br>                            size: 60, color: Colors.grey),<br>                      ),<br>                    ),<br>                  ),<br>                  Container(<br>                    decoration: BoxDecoration(<br>                      gradient: LinearGradient(<br>                        begin: Alignment.topCenter,<br>                        end: Alignment.bottomCenter,<br>                        colors: [<br>                          Colors.transparent,<br>                          Colors.black.withOpacity(0.6),<br>                        ],<br>                      ),<br>                    ),<br>                  ),<br>                  Positioned(<br>                    bottom: 12,<br>                    right: 12,<br>                    child: Container(<br>                      padding: const EdgeInsets.symmetric(<br>                          horizontal: 12, vertical: 6),<br>                      decoration: BoxDecoration(<br>                        gradient: LinearGradient(<br>                          colors: [Colors.black!, Colors.black!],<br>                        ),<br>                        borderRadius: BorderRadius.circular(16),<br>                        boxShadow: [<br>                          BoxShadow(<br>                            color: Colors.black.withOpacity(0.2),<br>                            blurRadius: 6,<br>                            offset: const Offset(0, 3),<br>                          ),<br>                        ],<br>                      ),<br>                      child: Text(<br>                        &quot;₹ ${_formatPrice(carData[&#39;price&#39;]?.toString() ?? &#39;&#39;)}&quot;,<br>                        style: TextStyle(<br>                          color: Colors.white,<br>                          fontSize: isSmallScreen ? 13 : 15,<br>                          fontWeight: FontWeight.bold,<br>                        ),<br>                        overflow: TextOverflow.ellipsis,<br>                        maxLines: 1,<br>                      ),<br>                    ),<br>                  ),<br>                ],<br>              ),<br>            ),<br>          ),<br>          SliverToBoxAdapter(<br>            child: Container(<br>              decoration: const BoxDecoration(<br>                color: Colors.white,<br>                borderRadius: BorderRadius.only(<br>                  topLeft: Radius.circular(20),<br>                  topRight: Radius.circular(20),<br>                ),<br>              ),<br>              child: Padding(<br>                padding: EdgeInsets.all(isSmallScreen ? 12.0 : 16.0),<br>                child: Column(<br>                  crossAxisAlignment: CrossAxisAlignment.start,<br>                  children: [<br>                    Row(<br>                      children: [<br>                        Expanded(<br>                          child: Text(<br>                            carData[&#39;title&#39;]?.toString() ?? &#39;&#39;,<br>                            style: TextStyle(<br>                              fontSize: isSmallScreen ? 20 : 24,<br>                              fontWeight: FontWeight.bold,<br>                              color: const Color(0xFF1A1A1A),<br>                              height: 1.2,<br>                            ),<br>                            maxLines: 2,<br>                            overflow: TextOverflow.ellipsis,<br>                          ),<br>                        ),<br>                        // Container(<br>                        //   padding: const EdgeInsets.symmetric(<br>                        //       horizontal: 10, vertical: 5),<br>                        //   decoration: BoxDecoration(<br>                        //     color: Colors.black,<br>                        //     borderRadius: BorderRadius.circular(16),<br>                        //     border: Border.all(color: Colors.green[200]!),<br>                        //   ),<br>                        //   child: Text(<br>                        //     &#39;VERIFIED&#39;,<br>                        //     style: TextStyle(<br>                        //       color: Colors.white,<br>                        //       fontSize: 9,<br>                        //       fontWeight: FontWeight.bold,<br>                        //     ),<br>                        //   ),<br>                        // ),<br>                      ],<br>                    ),<br>                    const SizedBox(height: 16),<br>                    if (carData[&#39;description&#39;] != null &amp;&amp;<br>                        carData[&#39;description&#39;].toString().isNotEmpty)<br>                      _buildDescriptionSection(<br>                          carData[&#39;description&#39;].toString(), isSmallScreen),<br>                    Container(<br>                      padding: const EdgeInsets.all(16),<br>                      decoration: BoxDecoration(<br>                        color: Colors.grey[850],<br>                        borderRadius: BorderRadius.circular(16),<br>                      ),<br>                      child: Column(<br>                        mainAxisSize: MainAxisSize.min,<br>                        children: [<br>                          Text(<br>                            &quot;₹ ${_formatPrice(carData[&#39;price&#39;]?.toString() ?? &#39;&#39;)}&quot;,<br>                            style: TextStyle(<br>                              fontSize: 24,<br>                              fontWeight: FontWeight.bold,<br>                              color: Colors.white,<br>                            ),<br>                          ),<br>                          const SizedBox(height: 16),<br>                          Row(<br>                            mainAxisAlignment: MainAxisAlignment.center,<br>                            children: [<br>                              _buildButton(&quot;Inquiry&quot;, onTap: ()async {<br>                                String contactNumber = carData[&#39;phonenumber&#39;]?.toString() ?? &#39;&#39;;<br>                                if (Platform.isAndroid || Platform.isIOS) {<br>                                  String url = &#39;whatsapp://send?phone=$contactNumber&#39;;<br>                                  try {<br>                                    await launchUrl(Uri.parse(url));<br>                                  } catch (e) {<br>                                    print(&quot;Could not launch WhatsApp: $e&quot;);<br>                                  }<br>                                }<br>                                // Handle inquiry<br>                              }),<br>                              const SizedBox(width: 16),<br>                              _buildButton(&quot;Book Now&quot;, onTap: () {<br>                                Navigator.push(context, MaterialPageRoute(builder: (context) =&gt; BookNowPage(),));<br><br>                                // Handle book now<br>                              }),<br>                            ],<br>                          ),<br>                        ],<br>                      ),<br>                    ),<br>                    SizedBox(height: 20,),<br><br>                    Container(<br>                      padding: const EdgeInsets.all(16),<br>                      decoration: BoxDecoration(<br>                        gradient: LinearGradient(<br>                          colors: [Colors.blue[50]!, Colors.indigo[50]!],<br>                          begin: Alignment.topLeft,<br>                          end: Alignment.bottomRight,<br>                        ),<br>                        borderRadius: BorderRadius.circular(16),<br>                        border: Border.all(color: Colors.blue[100]!),<br>                      ),<br>                      child: Column(<br>                        crossAxisAlignment: CrossAxisAlignment.start,<br>                        children: [<br><br>                          Row(<br>                            children: [<br>                              // Container(<br>                              //   padding: const EdgeInsets.all(6),<br>                              //   decoration: BoxDecoration(<br>                              //     color: Colors.blue[600],<br>                              //     borderRadius: BorderRadius.circular(8),<br>                              //   ),<br>                              //   child: const Icon(Icons.settings,<br>                              //       color: Colors.white, size: 18),<br>                              // ),<br>                              // const SizedBox(width: 10),<br>                              // Text(<br>                              //   &#39;Specifications&#39;,<br>                              //   style: TextStyle(<br>                              //     fontSize: isSmallScreen ? 16 : 18,<br>                              //     fontWeight: FontWeight.bold,<br>                              //     color: const Color(0xFF1A1A1A),<br>                              //   ),<br>                              // ),<br>                            ],<br>                          ),<br><br>                          const SizedBox(height: 12),<br>                          _buildSpecificationGrid(<br>                              isSmallScreen, isVerySmallScreen),<br>                        ],<br>                      ),<br>                    ),<br><br>                    const SizedBox(height: 16),<br>                    if (_hasFeatures())<br>                      // _buildFeaturesSection(isSmallScreen),<br>                    const SizedBox(height: 24),<br>                    _buildSocialShareSection(context, isSmallScreen),<br>                    const SizedBox(height: 16),<br><br><br>                  ],<br>                ),<br>              ),<br>            ),<br>          ),<br><br>        ],<br>      ),<br><br>    );<br>  }<br><br>  // Helper method to safely check if features exist<br>  bool _hasFeatures() {<br>    if (carData[&#39;features&#39;] == null) return false;<br><br>    // Check if features is a List<br>    if (carData[&#39;features&#39;] is List) {<br>      return (carData[&#39;features&#39;] as List).isNotEmpty;<br>    }<br><br>    // Check if features is a String<br>    if (carData[&#39;features&#39;] is String) {<br>      return (carData[&#39;features&#39;] as String).trim().isNotEmpty;<br>    }<br><br>    return false;<br>  }<br><br>  String _formatPrice(String price) {<br>    if (price.isEmpty) return &#39;&#39;;<br>    final number = double.tryParse(price.replaceAll(&#39;,&#39;, &#39;&#39;));<br>    if (number == null) return price;<br>    return number.toStringAsFixed(0).replaceAllMapped(<br>        RegExp(r&#39;(\d{1,3})(?=(\d{3})+(?!\d))&#39;), (Match m) =&gt; &#39;${m[1]},&#39;);<br>  }<br><br>  Future&lt;void&gt; _makePhoneCall() async {<br>    final phoneNumber = carData[&#39;phoneNumber&#39;]?.toString();<br>    if (phoneNumber != null &amp;&amp; phoneNumber.isNotEmpty) {<br>      final Uri launchUri = Uri(scheme: &#39;tel&#39;, path: phoneNumber);<br>      if (await canLaunchUrl(launchUri)) {<br>        await launchUrl(launchUri);<br>      } else {<br>        debugPrint(&#39;Could not launch $launchUri&#39;);<br>      }<br>    }<br>  }<br><br>  Future&lt;void&gt; _contactSeller() async {<br>    final phoneNumber = carData[&#39;phoneNumber&#39;]?.toString();<br>    if (phoneNumber != null &amp;&amp; phoneNumber.isNotEmpty) {<br>      final carName = carData[&#39;name&#39;]?.toString() ?? &#39;car&#39;;<br>      final Uri launchUri =<br>      Uri.parse(&quot;sms:$phoneNumber?body=I&#39;m interested in your $carName.&quot;);<br>      if (await canLaunchUrl(launchUri)) {<br>        await launchUrl(launchUri);<br>      } else {<br>        debugPrint(&#39;Could not launch $launchUri&#39;);<br>      }<br>    }<br>  }<br><br><br>  Future&lt;void&gt; _shareToSocial(BuildContext context, String platform) async {<br>// Add haptic feedback<br>    await HapticFeedback.lightImpact();<br><br>// Show snackbar<br>    ScaffoldMessenger.of(context).showSnackBar(<br>      SnackBar(<br>        content: Text(&#39;Sharing to $platform...&#39;),<br>        backgroundColor: Colors.blue[600],<br>        behavior: SnackBarBehavior.floating,<br>        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),<br>        duration: const Duration(seconds: 2),<br>      ),<br>    );<br><br>    final carName = carData[&#39;name&#39;]?.toString() ?? &#39;this car&#39;;<br>    final shareUrl =<br>        carData[&#39;imageUrl&#39;]?.toString() ?? &#39;https://example.com/car&#39;;<br>    final shareText = &#39;Check out $carName! $shareUrl&#39;;<br><br>    try {<br>      switch (platform) {<br>        case &#39;facebook&#39;:<br>// Try opening Facebook app<br>          final appUri = Uri.parse(<br>              &#39;fb://facewebmodal/f?href=${Uri.encodeComponent(&#39;https://www.facebook.com/sharer/sharer.php?u=$shareUrl&#39;)}&#39;);<br>          if (await canLaunchUrl(appUri)) {<br>            await launchUrl(appUri, mode: LaunchMode.externalApplication);<br>          } else {<br>// Fallback to web<br>            final webUri = Uri.parse(<br>                &#39;https://www.facebook.com/sharer/sharer.php?u=${Uri.encodeComponent(shareUrl)}&#39;);<br>            await launchUrl(webUri, mode: LaunchMode.externalApplication);<br>          }<br>          break;<br><br>        case &#39;instagram&#39;:<br>// Instagram doesn&#39;t support direct sharing via deep link; use share_plus<br>          await Share.share(<br>            shareText,<br>            subject: &#39;Check out this car!&#39;,<br>            sharePositionOrigin: const Rect.fromLTWH(0, 0, 10, 10),<br>          );<br>          break;<br><br>        case &#39;twitter&#39;:<br>// Try opening X app<br>          final appUri = Uri.parse(<br>              &#39;twitter://post?message=${Uri.encodeComponent(shareText)}&#39;);<br>          if (await canLaunchUrl(appUri)) {<br>            await launchUrl(appUri, mode: LaunchMode.externalApplication);<br>          } else {<br>// Fallback to web<br>            final webUri = Uri.parse(<br>                &#39;https://twitter.com/intent/tweet?text=${Uri.encodeComponent(shareText)}&#39;);<br>            await launchUrl(webUri, mode: LaunchMode.externalApplication);<br>          }<br>          break;<br><br>        case &#39;linkedin&#39;:<br>// Try opening LinkedIn app<br>          final appUri = Uri.parse(<br>              &#39;linkedin://shareArticle?mini=true&amp;url=${Uri.encodeComponent(shareUrl)}&amp;title=${Uri.encodeComponent(carName)}&#39;);<br>          if (await canLaunchUrl(appUri)) {<br>            await launchUrl(appUri, mode: LaunchMode.externalApplication);<br>          } else {<br>// Fallback to web<br>            final webUri = Uri.parse(<br>                &#39;https://www.linkedin.com/sharing/share-offsite/?url=${Uri.encodeComponent(shareUrl)}&#39;);<br>            await launchUrl(webUri, mode: LaunchMode.externalApplication);<br>          }<br>          break;<br><br>        default:<br>          return;<br>      }<br>    } catch (e) {<br>      debugPrint(&#39;Error sharing to $platform: $e&#39;);<br>      ScaffoldMessenger.of(context).showSnackBar(<br>        SnackBar(<br>          content: const Text(&#39;Failed to share. Please try again.&#39;),<br>          backgroundColor: Colors.red[600],<br>          behavior: SnackBarBehavior.floating,<br>          shape:<br>          RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),<br>          duration: const Duration(seconds: 2),<br>        ),<br>      );<br>    }<br>  }<br><br>  Widget _buildSocialShareSection(BuildContext context, bool isSmallScreen) {<br>    return Container(<br>      padding: const EdgeInsets.all(0),<br>      decoration: BoxDecoration(<br>        color: Colors.white,<br>        borderRadius: BorderRadius.circular(16),<br>        border: Border.all(color: Colors.grey[200]!),<br>        boxShadow: [<br>          BoxShadow(<br>            color: Colors.grey.withOpacity(0.1),<br>            blurRadius: 8,<br>            offset: const Offset(0, 4),<br>          ),<br>        ],<br>      ),<br>      child: Column(<br>        children: [<br>          Row(<br>            mainAxisAlignment: MainAxisAlignment.center,<br>            children: [<br>              Container(<br>                padding: const EdgeInsets.all(6),<br>                decoration: BoxDecoration(<br>                  color: Colors.blue[600],<br>                  borderRadius: BorderRadius.circular(8),<br>                ),<br>                child: const Icon(Icons.share, color: Colors.white, size: 18),<br>              ),<br>              const SizedBox(width: 10),<br>              Text(<br>                &#39;Share with Friends&#39;,<br>                style: TextStyle(<br>                  fontSize: isSmallScreen ? 16 : 18,<br>                  fontWeight: FontWeight.bold,<br>                  color: const Color(0xFF1A1A1A),<br>                ),<br>              ),<br>            ],<br>          ),<br>          const SizedBox(height: 16),<br><br>          Row(<br>            mainAxisAlignment: MainAxisAlignment.spaceEvenly,<br>            children: [<br>              _buildSocialIcon(<br>                gradient: LinearGradient(<br>                    colors: [const Color(0xFF1877F2), const Color(0xFF42A5F5)]),<br>                icon: Icons.facebook,<br>                label: &#39;Facebook&#39;,<br>                onTap: () =&gt; _shareToSocial(context, &#39;facebook&#39;),<br>                isSmallScreen: isSmallScreen,<br>              ),<br>              _buildSocialIcon(<br>                gradient: LinearGradient(<br>                  colors: [<br>                    const Color(0xFF833AB4),<br>                    const Color(0xFFE1306C),<br>                    const Color(0xFFF77737),<br>                  ],<br>                  begin: Alignment.topLeft,<br>                  end: Alignment.bottomRight,<br>                ),<br>                icon: Icons.camera_alt,<br>                label: &#39;Instagram&#39;,<br>                onTap: () =&gt; _shareToSocial(context, &#39;instagram&#39;),<br>                isSmallScreen: isSmallScreen,<br>              ),<br>              _buildSocialIcon(<br>                gradient:<br>                LinearGradient(colors: [Colors.black, Colors.grey[800]!]),<br>                customWidget: const Text(<br>                  &#39;X&#39;,<br>                  style: TextStyle(<br>                    color: Colors.white,<br>                    fontSize: 16,<br>                    fontWeight: FontWeight.bold,<br>                  ),<br>                ),<br>                label: &#39;X&#39;,<br>                onTap: () =&gt; _shareToSocial(context, &#39;twitter&#39;),<br>                isSmallScreen: isSmallScreen,<br>              ),<br>              _buildSocialIcon(<br>                gradient: LinearGradient(<br>                    colors: [const Color(0xFF0077B5), const Color(0xFF00A0DC)]),<br>                icon: Icons.business,<br>                label: &#39;LinkedIn&#39;,<br>                onTap: () =&gt; _shareToSocial(context, &#39;linkedin&#39;),<br>                isSmallScreen: isSmallScreen,<br>              ),<br>            ],<br>          ),<br>          SizedBox(height: 30,),<br>          Container(<br>            decoration: BoxDecoration(<br>              color: Colors.white,<br>              border: Border.all(color: Colors.grey[300]!),<br>              borderRadius: BorderRadius.circular(4),<br>            ),<br>            child: Column(<br>              children: [<br>                // Color Row<br>                Container(<br>                  padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),<br>                  child: Row(<br>                    children: [<br>                      Expanded(<br>                        child: Text(<br>                          &#39;Color&#39;,<br>                          style: TextStyle(<br>                            fontSize: 16,<br>                            fontWeight: FontWeight.w500,<br>                            color: Colors.grey[800],<br>                          ),<br>                        ),<br>                      ),<br>                      Expanded(<br>                        child: Text(<br>                          carData[&#39;color&#39;]?.toString() ?? &#39;&#39;,<br>                          style: TextStyle(<br>                            fontSize: 16,<br>                            color: Colors.grey[700],<br>                          ),<br>                        ),<br>                      ),<br>                    ],<br>                  ),<br>                ),<br><br>                // Divider<br>                Divider(<br>                  height: 1,<br>                  thickness: 1,<br>                  color: Colors.grey[300],<br>                  indent: 16,<br>                  endIndent: 16,<br>                ),<br><br>                // Brand Row<br>                Container(<br>                  padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),<br>                  child: Row(<br>                    children: [<br>                      Expanded(<br>                        child: Text(<br>                          &#39;Brand&#39;,<br>                          style: TextStyle(<br>                            fontSize: 16,<br>                            fontWeight: FontWeight.w500,<br>                            color: Colors.grey[800],<br>                          ),<br>                        ),<br>                      ),<br>                      Expanded(<br>                        child: Text(<br>                          &#39;0&#39;,<br>                          style: TextStyle(<br>                            fontSize: 16,<br>                            color: Colors.grey[700],<br>                          ),<br>                        ),<br>                      ),<br>                    ],<br>                  ),<br>                ),<br><br>                // Divider<br>                Divider(<br>                  height: 1,<br>                  thickness: 1,<br>                  color: Colors.grey[300],<br>                  indent: 16,<br>                  endIndent: 16,<br>                ),<br><br>                // City Row<br>                Container(<br>                  padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),<br>                  child: Row(<br>                    children: [<br>                      Expanded(<br>                        child: Text(<br>                          &#39;City&#39;,<br>                          style: TextStyle(<br>                            fontSize: 16,<br>                            fontWeight: FontWeight.w500,<br>                            color: Colors.grey[800],<br>                          ),<br>                        ),<br>                      ),<br>                      Expanded(<br>                        child: Text(<br>                          carData[&#39;city&#39;]?.toString() ?? &#39;&#39;,<br>                          style: TextStyle(<br>                            fontSize: 16,<br>                            color: Colors.grey[700],<br>                          ),<br>                        ),<br>                      ),<br>                    ],<br>                  ),<br>                ),<br>              ],<br>            ),<br>          ),<br><br>          SizedBox(height: 24),<br><br>          // SKU Section<br>          RichText(<br>            text: TextSpan(<br>              children: [<br>                TextSpan(<br>                  text: &#39;SKU: ${carData[&#39;sku&#39;]?.toString() ?? &#39;&#39;}&#39;,<br>                  style: TextStyle(<br>                    color: Colors.grey[700],<br>                    fontSize: 16,<br>                    fontWeight: FontWeight.w500,<br>                  ),<br>                ),<br><br>              ],<br>            ),<br>          ),<br><br>          SizedBox(height: 16),<br><br>          // Categories Section<br>          RichText(<br>            text: TextSpan(<br>              children: [<br>                TextSpan(<br>                  text: &#39;Categories: &#39;,<br>                  style: TextStyle(<br>                    color: Colors.grey[700],<br>                    fontSize: 16,<br>                    fontWeight: FontWeight.w500,<br>                  ),<br>                ),<br>                TextSpan(<br>                  text: &#39;1&#39;,<br>                  style: TextStyle(<br>                    color: Colors.blue,<br>                    fontSize: 16,<br>                    decoration: TextDecoration.underline,<br>                  ),<br>                ),<br>              ],<br>            ),<br>          ),<br><br>          SizedBox(height: 16),<br><br>          // Tags Section<br>          RichText(<br>            text: TextSpan(<br>              children: [<br>                TextSpan(<br>                  text: &#39;Tags: &#39;,<br>                  style: TextStyle(<br>                    color: Colors.grey[700],<br>                    fontSize: 16,<br>                    fontWeight: FontWeight.w500,<br>                  ),<br>                ),<br>                TextSpan(<br>                  text: carData[&#39;tags&#39;]?.toString() ?? &#39;&#39;,<br>                  style: TextStyle(<br>                    color: Colors.blue,<br>                    fontSize: 16,<br>                    decoration: TextDecoration.underline,<br>                  ),<br>                )<br><br>              ],<br>            ),<br>          ),<br>          SizedBox(height: 20,),<br>          buildTabBarWithView(),<br><br>          CarFooter(),<br><br><br><br>        ],<br>      ),<br>    );<br>  }<br><br>  Widget _buildSocialIcon({<br>    required Gradient gradient,<br>    IconData? icon,<br>    Widget? customWidget,<br>    required String label,<br>    required VoidCallback onTap,<br>    required bool isSmallScreen,<br>  }) {<br>    return GestureDetector(<br>      onTap: onTap,<br>      child: AnimatedContainer(<br>        duration: const Duration(milliseconds: 200),<br>        transform: Matrix4.identity()..scale(1.0),<br>        child: Column(<br>          children: [<br>            Container(<br>              width: isSmallScreen ? 48 : 56,<br>              height: isSmallScreen ? 48 : 56,<br>              decoration: BoxDecoration(<br>                gradient: gradient,<br>                borderRadius: BorderRadius.circular(14),<br>                boxShadow: [<br>                  BoxShadow(<br>                    color: Colors.black.withOpacity(0.1),<br>                    blurRadius: 6,<br>                    offset: const Offset(0, 3),<br>                  ),<br>                ],<br>              ),<br>              child: Center(<br>                child: customWidget ??<br>                    Icon(icon,<br>                        color: Colors.white, size: isSmallScreen ? 24 : 28),<br>              ),<br>            ),<br>            const SizedBox(height: 6),<br>            Text(<br>              label,<br>              style: TextStyle(<br>                fontSize: isSmallScreen ? 11 : 12,<br>                fontWeight: FontWeight.w600,<br>                color: Colors.grey[700],<br>              ),<br>            ),<br><br>          ],<br>        ),<br>      ),<br>    );<br>  }<br><br>  Widget buildTabBarWithView() {<br>    return DefaultTabController(<br>      length: 2,<br>      child: Column(<br>        children: [<br>      Container(<br>      decoration: BoxDecoration(<br>      color: Colors.white,<br>        border: Border(<br>          bottom: BorderSide(color: Colors.grey[300]!),<br>        ),<br>      ),<br>      child: const TabBar(<br>        labelColor: Colors.blue,<br>        unselectedLabelColor: Colors.grey,<br>        indicatorColor: Colors.blue,<br>        indicatorWeight: 2.0,<br>        tabs: [<br>          Tab(text: &#39;Features &#39;),<br>          Tab(text: &#39;Details&#39;),<br>        ],<br>      ),<br>    ),<br>    // Give the TabBarView a fixed height instead of Expanded<br>    Container(<br>    height: 300, // Fixed height for the TabBarView<br>    child: TabBarView(<br>    children: [<br>    // Details Tab Content<br>    Container(<br>    padding: const EdgeInsets.all(16),<br>    child: SingleChildScrollView(<br>    child: Column(<br>    crossAxisAlignment: CrossAxisAlignment.start,<br>    children: [<br>    Text(<br>    &#39;Car Feature&#39;,<br>    style: TextStyle(<br>    fontSize: 18,<br>    fontWeight: FontWeight.bold,<br>    color: Colors.grey[800],<br>    ),<br>    ),<br>    const SizedBox(height: 16),<br>    _buildDetailRow(&#39;Model Year&#39;, carData[&#39;model&#39;]?.toString() ?? &#39;&#39;),<br>    _buildDetailRow(&#39;Kilometers Driven&#39;, &#39;${carData[&#39;kms_driven&#39;] ?? &#39;&#39;} km&#39;),<br>    _buildDetailRow(&#39;Fuel Type&#39;, carData[&#39;fuel&#39;]?.toString() ?? &#39;&#39;),<br>    _buildDetailRow(&#39;Transmission&#39;, carData[&#39;transmission&#39;]?.toString() ?? &#39;&#39;),<br>    _buildDetailRow(&#39;Number Of Owner&#39;, carData[&#39;seller&#39;]?.toString() ?? &#39;&#39;),<br>    _buildDetailRow(&#39;Color&#39;, carData[&#39;color&#39;]?.toString() ?? &#39;&#39;),<br>    // if (carData[&#39;description&#39;] != null &amp;&amp; carData[&#39;description&#39;].toString().isNotEmpty)<br>    Column(<br>    crossAxisAlignment: CrossAxisAlignment.start,<br>    children: [<br>    const SizedBox(height: 8),<br>    Text(<br>    &#39;Description&#39;,<br>    style: TextStyle(<br>    fontSize: 14,<br>    fontWeight: FontWeight.w600,<br>    color: Colors.grey[700],<br>    ),<br>    ),<br>    const SizedBox(height: 4),<br>    Text(<br>    carData[&#39;description&#39;]?.toString() ?? &#39;No description available&#39;,<br>    style: TextStyle(<br>    fontSize: 14,<br>    color: Colors.grey[600],<br>    height: 1.4,<br>    ),<br>    ),<br>    ],<br>    ),<br>    ],<br>    ),<br>    ),<br>    ),<br>    // Features Tab Content<br>    Container(<br>    padding: const EdgeInsets.all(16),<br>    child: SingleChildScrollView(<br>    child: Column(<br>    crossAxisAlignment: CrossAxisAlignment.start,<br>    children: [<br>    Text(<br>    &#39;Car Details&#39;,<br>    style: TextStyle(<br>    fontSize: 18,<br>    fontWeight: FontWeight.bold,<br>    color: Colors.grey[800],<br>    ),<br>    ),<br>    const SizedBox(height: 16),<br>    if (_hasFeatures())<br>    _buildFeaturesList()<br>    else<br><br>      Center(<br>        child: Column(<br>          mainAxisAlignment: MainAxisAlignment.center,<br>          children: [<br>            Icon(<br>              Icons.info_outline,<br>              size: 48,<br>              color: Colors.grey[400],<br>            ),<br>            const SizedBox(height: 16),<br>            Text(<br>              &#39;No features available&#39;,<br>              style: TextStyle(<br>                fontSize: 16,<br>                color: Colors.grey[600],<br>              ),<br>            ),<br>          ],<br>        ),<br>      ),<br>    ],<br>    ),<br>    ),<br>    ),<br>    ],<br>    ),<br>    ),<br>        ],<br>      ),<br>    );<br>  }<br><br>  // Helper method to build detail rows<br>  Widget _buildDetailRow(String label, String value) {<br>    return Padding(<br>      padding: const EdgeInsets.only(bottom: 12),<br>      child: Row(<br>        crossAxisAlignment: CrossAxisAlignment.start,<br>        children: [<br>          Expanded(<br>            flex: 2,<br>            child: Text(<br>              label,<br>              style: TextStyle(<br>                fontSize: 14,<br>                fontWeight: FontWeight.w600,<br>                color: Colors.grey[700],<br>              ),<br>            ),<br>          ),<br>          Expanded(<br>            flex: 3,<br>            child: Text(<br>              value.isNotEmpty ? value : &#39;N/A&#39;,<br>              style: TextStyle(<br>                fontSize: 14,<br>                color: Colors.grey[600],<br>              ),<br>            ),<br>          ),<br>        ],<br>      ),<br>    );<br>  }<br><br>  // Helper method to build features list<br>  Widget _buildFeaturesList() {<br>    List&lt;String&gt; features = [];<br><br>    if (carData[&#39;features&#39;] is List) {<br>      features = (carData[&#39;features&#39;] as List).map((e) =&gt; e.toString()).toList();<br>    } else if (carData[&#39;features&#39;] is String) {<br>      String featuresString = carData[&#39;features&#39;] as String;<br>      features = featuresString.split(&#39;,&#39;).map((e) =&gt; e.trim()).where((e) =&gt; e.isNotEmpty).toList();<br>    }<br><br>    if (features.isEmpty) {<br>      return Center(<br>        child: Text(<br>          &#39;No features available&#39;,<br>          style: TextStyle(<br>            fontSize: 16,<br>            color: Colors.grey[600],<br>          ),<br>        ),<br>      );<br>    }<br><br>    return Wrap(<br>      spacing: 8,<br>      runSpacing: 8,<br>      children: features.map((feature) =&gt; Container(<br>        padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),<br>        decoration: BoxDecoration(<br>          color: Colors.blue[50],<br>          borderRadius: BorderRadius.circular(16),<br>          border: Border.all(color: Colors.blue[200]!),<br>        ),<br>        child: Text(<br>          feature,<br>          style: TextStyle(<br>            fontSize: 12,<br>            color: Colors.blue[700],<br>            fontWeight: FontWeight.w500,<br>          ),<br>        ),<br>      )).toList(),<br>    );<br>  }<br><br>  // Helper method to build description section<br>  Widget _buildDescriptionSection(String description, bool isSmallScreen) {<br>    return Container(<br>      margin: const EdgeInsets.only(bottom: 16),<br>      padding: const EdgeInsets.all(16),<br>      decoration: BoxDecoration(<br>        color: Colors.grey[50],<br>        borderRadius: BorderRadius.circular(12),<br>        border: Border.all(color: Colors.grey[200]!),<br>      ),<br>      child: Column(<br>        crossAxisAlignment: CrossAxisAlignment.start,<br>        children: [<br>          Text(<br>            &#39;Description&#39;,<br>            style: TextStyle(<br>              fontSize: isSmallScreen ? 16 : 18,<br>              fontWeight: FontWeight.bold,<br>              color: const Color(0xFF1A1A1A),<br>            ),<br>          ),<br>          const SizedBox(height: 8),<br>          Text(<br>            description,<br>            style: TextStyle(<br>              fontSize: 14,<br>              color: Colors.grey[700],<br>              height: 1.5,<br>            ),<br>          ),<br>        ],<br>      ),<br>    );<br>  }<br><br>  // Helper method to build specification grid<br>  Widget _buildSpecificationGrid(bool isSmallScreen, bool isVerySmallScreen) {<br>    final specs = [<br>      {&#39;icon&#39;: Icons.calendar_today, &#39;label&#39;: &#39;Year&#39;, &#39;value&#39;: carData[&#39;model&#39;]?.toString() ?? &#39;&#39;},<br>      {&#39;icon&#39;: Icons.speed, &#39;label&#39;: &#39;KM Driven&#39;, &#39;value&#39;: &#39;${carData[&#39;kms_driven&#39;] ?? &#39;&#39;} km&#39;},<br>      {&#39;icon&#39;: Icons.local_gas_station, &#39;label&#39;: &#39;Fuel&#39;, &#39;value&#39;: carData[&#39;fuel&#39;]?.toString() ?? &#39;&#39;},<br>      {&#39;icon&#39;: Icons.settings, &#39;label&#39;: &#39;Transmission&#39;, &#39;value&#39;: carData[&#39;transmission&#39;]?.toString() ?? &#39;&#39;},<br>      {&#39;icon&#39;: Icons.person, &#39;label&#39;: &#39;Owner&#39;, &#39;value&#39;: carData[&#39;seller&#39;]?.toString() ?? &#39;&#39;},<br>      {&#39;icon&#39;: Icons.palette, &#39;label&#39;: &#39;Color&#39;, &#39;value&#39;: carData[&#39;color&#39;]?.toString() ?? &#39;&#39;},<br>    ];<br><br>    return GridView.builder(<br>      shrinkWrap: true,<br>      physics: const NeverScrollableScrollPhysics(),<br>      gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(<br>        crossAxisCount: isVerySmallScreen ? 1 : (isSmallScreen ? 9 : 3),<br>        childAspectRatio: isVerySmallScreen ? 4 : 3,<br>        crossAxisSpacing: 8,<br>        mainAxisSpacing: 8,<br>      ),<br>      itemCount: specs.length,<br>      itemBuilder: (context, index) {<br>        final spec = specs[index];<br>        return Container(<br>          // padding: const EdgeInsets.all(12),<br>          decoration: BoxDecoration(<br>            color: Colors.white,<br>            borderRadius: BorderRadius.circular(12),<br>            border: Border.all(color: Colors.grey[300]!),<br>          ),<br>          child: Column(<br>            mainAxisAlignment: MainAxisAlignment.center,<br>            children: [<br>              Icon(<br>                spec[&#39;icon&#39;] as IconData,<br>                size: 20,<br>                color: Colors.blue[600],<br>              ),<br>              const SizedBox(height: 4),<br>              Text(<br>                spec[&#39;label&#39;] as String,<br>                style: TextStyle(<br>                  fontSize: 10,<br>                  fontWeight: FontWeight.w600,<br>                  color: Colors.grey[700],<br>                ),<br>                textAlign: TextAlign.center,<br>              ),<br>              const SizedBox(height: 2),<br>              Text(<br>                (spec[&#39;value&#39;] as String).isNotEmpty ? spec[&#39;value&#39;] as String : &#39;N/A&#39;,<br>                style: TextStyle(<br>                  fontSize: 9,<br>                  color: Colors.grey[600],<br>                ),<br>                textAlign: TextAlign.center,<br>                maxLines: 1,<br>                overflow: TextOverflow.ellipsis,<br>              ),<br>            ],<br>          ),<br>        );<br>      },<br>    );<br>  }<br><br>  // Helper method to build features section<br>  Widget _buildFeaturesSection(bool isSmallScreen) {<br>    return Container(<br>      padding: const EdgeInsets.all(16),<br>      decoration: BoxDecoration(<br>        gradient: LinearGradient(<br>          colors: [Colors.green[50]!, Colors.teal[50]!],<br>          begin: Alignment.topLeft,<br>          end: Alignment.bottomRight,<br>        ),<br>        borderRadius: BorderRadius.circular(16),<br>        border: Border.all(color: Colors.green[100]!),<br>      ),<br>      child: Column(<br>        crossAxisAlignment: CrossAxisAlignment.start,<br>        children: [<br>          Row(<br>            children: [<br>              Container(<br>                padding: const EdgeInsets.all(6),<br>                decoration: BoxDecoration(<br>                  color: Colors.green[600],<br>                  borderRadius: BorderRadius.circular(8),<br>                ),<br>                child: const Icon(Icons.star, color: Colors.white, size: 18),<br>              ),<br>              const SizedBox(width: 10),<br>              Text(<br>                &#39;Features&#39;,<br>                style: TextStyle(<br>                  fontSize: isSmallScreen ? 16 : 18,<br>                  fontWeight: FontWeight.bold,<br>                  color: const Color(0xFF1A1A1A),<br>                ),<br>              ),<br>            ],<br>          ),<br>          const SizedBox(height: 12),<br>          _buildFeaturesList(),<br>        ],<br>      ),<br>    );<br>  }<br><br>  // Helper method to build action buttons<br>  Widget _buildButton(String text, {required VoidCallback onTap}) {<br>    return Expanded(<br>      child: GestureDetector(<br>        onTap: onTap,<br>        child: Container(<br>          padding: const EdgeInsets.symmetric(vertical: 12),<br>          decoration: BoxDecoration(<br>            gradient: LinearGradient(<br>              colors: [Colors.blue[600]!, Colors.blue[700]!],<br>            ),<br>            borderRadius: BorderRadius.circular(8),<br>            boxShadow: [<br>              BoxShadow(<br>                color: Colors.blue.withOpacity(0.3),<br>                blurRadius: 4,<br>                offset: const Offset(0, 2),<br>              ),<br>            ],<br>          ),<br>          child: Text(<br>            text,<br>            textAlign: TextAlign.center,<br>            style: const TextStyle(<br>              color: Colors.white,<br>              fontSize: 16,<br>              fontWeight: FontWeight.bold,<br>            ),<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f70d12eec1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Direction Data Suceedfully]]></title>
            <link>https://sandeepkumaredugaon.medium.com/direction-data-suceedfully-1edcf80b2178?source=rss-0fc1a07cda66------2</link>
            <guid isPermaLink="false">https://medium.com/p/1edcf80b2178</guid>
            <dc:creator><![CDATA[Sandeep Kumar]]></dc:creator>
            <pubDate>Sat, 19 Jul 2025 01:39:46 GMT</pubDate>
            <atom:updated>2025-07-19T01:39:46.683Z</atom:updated>
            <content:encoded><![CDATA[<p>Direction Data Suceedfully</p><pre>import &#39;package:cloud_firestore/cloud_firestore.dart&#39;;<br>import &#39;package:firebase_auth/firebase_auth.dart&#39;;<br>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:geolocator/geolocator.dart&#39;;<br>import &#39;package:get/get.dart&#39;;<br>import &#39;package:intl/intl.dart&#39;;<br>import &#39;package:table_calendar/table_calendar.dart&#39;;<br>import &#39;package:google_maps_flutter/google_maps_flutter.dart&#39;;<br><br>import &#39;../Views/HomePage/DriverCallReached.dart&#39;;<br>import &#39;NearByService.dart&#39;;<br><br>class RidesPage extends StatefulWidget {<br>  const RidesPage({Key? key}) : super(key: key);<br><br>  @override<br>  _RidesPageState createState() =&gt; _RidesPageState();<br>}<br><br>class _RidesPageState extends State&lt;RidesPage&gt; {<br>  final DirectionsController directionsController =<br>  Get.put(DirectionsController());<br><br>  User? _user;<br>  String? _userName;<br>  String? _userEmail;<br>  String? _userImage;<br><br>  Future&lt;void&gt; _getUserData() async {<br>    _user = FirebaseAuth.instance.currentUser;<br>    if (_user != null) {<br>      DocumentSnapshot userSnapshot = await FirebaseFirestore.instance<br>          .collection(&#39;users&#39;)<br>          .doc(_user!.uid)<br>          .get();<br>      if (userSnapshot.exists) {<br>        setState(() {<br>          _userName = userSnapshot[&#39;name&#39;];<br>          _userEmail = userSnapshot[&#39;email&#39;];<br>          _userImage = userSnapshot[&#39;imageUrl&#39;];<br><br>        });<br>      } else {<br>        Get.snackbar(&#39;Error&#39;, &#39;User data not found.&#39;);<br>      }<br>    }<br>  }<br><br>  @override<br>  void initState() {<br>    super.initState();<br>    _getUserData();<br>  }<br><br>  CalendarFormat _calendarFormat = CalendarFormat.month;<br>  DateTime _focusedDay = DateTime.now();<br>  DateTime? _selectedDay;<br><br>  void _showRideDetails(DirectionData data) {<br>    showModalBottomSheet(<br>      context: context,<br>      builder: (context) {<br>        LatLng startLatLng = LatLng(<br>          data.startLatitude,<br>          data.startLongitude,<br>        );<br>        LatLng endLatLng = LatLng(<br>          data.endLatitude,<br>          data.endLongitude,<br>        );<br><br>        return Scaffold(<br>          appBar: AppBar(<br>            title: Text(&#39;Ride Details&#39;),<br>          ),<br>          body: Column(<br>            children: [<br>              Expanded(<br>                flex: 2,<br>                child: ListView(<br>                  padding: EdgeInsets.all(16.0),<br>                  children: [<br>                    ListTile(title: Text(&#39;Pickup: ${data.pickup}&#39;)),<br>                    ListTile(title: Text(&#39;Destination: ${data.destination}&#39;)),<br>                    ListTile(<br>                        title: Text(&#39;Start Latitude: ${data.startLatitude}&#39;)),<br>                    ListTile(<br>                        title: Text(&#39;Start Longitude: ${data.startLongitude}&#39;)),<br>                    ListTile(title: Text(&#39;End Latitude: ${data.endLatitude}&#39;)),<br>                    ListTile(<br>                        title: Text(&#39;End Longitude: ${data.endLongitude}&#39;)),<br>                    ListTile(title: Text(&#39;Duration: ${data.duration}&#39;)),<br>                    ListTile(title: Text(&#39;Distance: ${data.distance}&#39;)),<br>                    ListTile(<br>                        title: Text(<br>                            &#39;Total Amount: ₹${data.totalAmount.toStringAsFixed(2)}&#39;)),<br>                    ListTile(<br>                        title: Text(<br>                            &#39;Date Time: ${DateFormat(&#39;yyyy-MM-dd HH:mm:ss&#39;).format(data.timestamp)}&#39;)),<br>                  ],<br>                ),<br>              ),<br>              Expanded(<br>                flex: 2,<br>                child: GoogleMap(<br>                  initialCameraPosition: CameraPosition(<br>                    target: startLatLng,<br>                    zoom: 20.0,<br>                  ),<br>                  markers: {<br>                    Marker(<br>                      markerId: MarkerId(&#39;start&#39;),<br>                      position: startLatLng,<br>                      infoWindow: InfoWindow(title: &#39;Pickup Location&#39;),<br>                    ),<br>                    Marker(<br>                      markerId: MarkerId(&#39;end&#39;),<br>                      position: endLatLng,<br>                      infoWindow: InfoWindow(title: &#39;Destination&#39;),<br>                    ),<br>                  },<br>                  polylines: {<br>                    Polyline(<br>                      polylineId: PolylineId(&#39;route&#39;),<br>                      points: [startLatLng, endLatLng],<br>                      color: Colors.blue,<br>                      width: 5,<br>                    ),<br>                  },<br>                ),<br>              ),<br>              Padding(<br>                padding: const EdgeInsets.all(16.0),<br>                child: ElevatedButton(<br>                  onPressed: () async {<br>                    try {<br>                      // Update ride status to &#39;Accepted&#39; in Firestore<br>                      await FirebaseFirestore.instance<br>                          .collection(&#39;directions_data&#39;)<br>                          .doc(data.id)<br>                          .update({&#39;status&#39;: &#39;Accepted&#39;});<br><br>                      // Optionally, navigate to another page or show a confirmation message<br>                      Get.snackbar(<br>                        &#39;Ride Accepted&#39;,<br>                        &#39;You have accepted the ride!&#39;,<br>                        snackPosition: SnackPosition.BOTTOM,<br>                      );<br>                      Navigator.of(context).pop(); // Close the bottom sheet<br>                    } catch (e) {<br>                      Get.snackbar(<br>                        &#39;Error&#39;,<br>                        &#39;Failed to update ride status.&#39;,<br>                        snackPosition: SnackPosition.BOTTOM,<br>                      );<br>                    }<br>                  },<br>                  child: Text(&#39;Accept Ride&#39;),<br>                ),<br>              ),<br>            ],<br>          ),<br>        );<br>      },<br>    );<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(<br>        title: Text(&#39;Rides&#39;),<br>      ),<br>      body: Column(<br>        children: [<br>          TableCalendar(<br>            firstDay: DateTime.now().subtract(Duration(days: 365)),<br>            lastDay: DateTime.now().add(Duration(days: 365)),<br>            focusedDay: _focusedDay,<br>            calendarFormat: _calendarFormat,<br>            selectedDayPredicate: (day) {<br>              return isSameDay(_selectedDay, day);<br>            },<br>            onDaySelected: (selectedDay, focusedDay) {<br>              setState(() {<br>                _selectedDay = selectedDay;<br>                _focusedDay = focusedDay;<br>              });<br>            },<br>            onFormatChanged: (format) {<br>              setState(() {<br>                _calendarFormat = format;<br>              });<br>            },<br>          ),<br>          // Expanded(<br>          //   child: Obx(() {<br>          //     if (directionsController.directionsList.isEmpty) {<br>          //       return Center(<br>          //         child: Text(<br>          //           &#39;No Directions Data Available&#39;,<br>          //           style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),<br>          //         ),<br>          //       );<br>          //     } else {<br>          //       return ListView.builder(<br>          //         itemCount: directionsController.directionsList.length,<br>          //         itemBuilder: (context, index) {<br>          //           DirectionData data = directionsController.directionsList[index];<br>          //           return Padding(<br>          //             padding: const EdgeInsets.all(8.0),<br>          //             child: Card(<br>          //               shape: RoundedRectangleBorder(<br>          //                 borderRadius: BorderRadius.circular(10),<br>          //               ),<br>          //               elevation: 5,<br>          //               child: ListTile(<br>          //                 leading: Icon(Icons.directions, color: Colors.teal),<br>          //                 title: Text(<br>          //                   &#39;Name: ${_userName ?? &#39;N/A&#39;}&#39;,<br>          //                   style: TextStyle(fontWeight: FontWeight.bold),<br>          //                 ),<br>          //                 subtitle: Column(<br>          //                   crossAxisAlignment: CrossAxisAlignment.start,<br>          //                   children: [<br>          //                     Text(&#39;Duration: ${data.duration}&#39;),<br>          //                     Text(&#39;Distance: ${data.distance}&#39;),<br>          //                     Text(&#39;Total Amount: ₹${data.totalAmount.toStringAsFixed(2)}&#39;),<br>          //                     Text(&#39;Pickup: ${data.pickup}&#39;),<br>          //                     Text(&#39;Destination: ${data.destination}&#39;),<br>          //                     Text(<br>          //                       &#39;Date Time: ${DateFormat(&#39;yyyy-MM-dd HH:mm:ss&#39;).format(data.timestamp)}&#39;,<br>          //                       style: TextStyle(fontSize: 14),<br>          //                     ),<br>          //                   ],<br>          //                 ),<br>          //                 trailing: Icon(Icons.arrow_forward_ios, color: Colors.teal),<br>          //                 onTap: () =&gt; _showRideDetails(data),<br>          //               ),<br>          //             ),<br>          //           );<br>          //         },<br>          //       );<br>          //     }<br>          //   }),<br>          // ),<br>        ],<br>      ),<br>    );<br>  }<br>}<br><br><br><br><br>class DirectionData {<br>  final String distance;<br>  final String duration;<br>  final String username;<br>  final String status;<br>  final String userphone;<br>  final String pickup;<br>  final String? userimage;<br>  final String destination;<br>  final double totalAmount;<br>  final DateTime timestamp;<br>  final double startLatitude;<br>  final double startLongitude;<br>  final double endLatitude;<br>  final double endLongitude;<br>  final String? acceptedDriverId;<br>  final String id;<br>  final String tripType;<br>  final bool isScheduled;<br>  final DateTime? scheduledDatetime;<br>  final DateTime createdAt;<br><br>  DirectionData({<br>    required this.distance,<br>    required this.duration,<br>    required this.username,<br>    required this.status,<br>    required this.userphone,<br>    this.userimage,<br>    required this.totalAmount,<br>    required this.pickup,<br>    required this.destination,<br>    required this.timestamp,<br>    required this.startLatitude,<br>    required this.startLongitude,<br>    required this.endLatitude,<br>    required this.endLongitude,<br>    required this.id,<br>    this.acceptedDriverId,<br>    required this.tripType,<br>    required this.isScheduled,<br>    this.scheduledDatetime,<br>    required this.createdAt,<br>  });<br><br>  factory DirectionData.fromDocumentSnapshot(DocumentSnapshot doc) {<br>    final data = doc.data() as Map&lt;String, dynamic&gt;;<br><br>    return DirectionData(<br>      distance: data[&#39;distance&#39;] as String,<br>      duration: data[&#39;duration&#39;] as String,<br>      username: data[&#39;user_name&#39;] as String,<br>      userphone: data[&#39;user_phone&#39;] as String,<br>      status: data[&#39;status&#39;] as String,<br>      userimage: data[&#39;user_image&#39;] as String?,<br>      pickup: data[&#39;pickup&#39;] as String,<br>      destination: data[&#39;destination&#39;] as String,<br>      timestamp: (data[&#39;timestamp&#39;] as Timestamp).toDate(),<br>      totalAmount: (data[&#39;total_amount&#39;] as num).toDouble(),<br>      startLatitude: data[&#39;start_latitude&#39;] as double,<br>      startLongitude: data[&#39;start_longitude&#39;] as double,<br>      endLatitude: data[&#39;end_latitude&#39;] as double,<br>      endLongitude: data[&#39;end_longitude&#39;] as double,<br>      acceptedDriverId: data[&#39;accepted_driver_id&#39;] as String?,<br>      tripType: data[&#39;trip_type&#39;] as String,<br>      isScheduled: data[&#39;is_scheduled&#39;] as bool,<br>      scheduledDatetime: data[&#39;scheduled_datetime&#39;] != null<br>          ? (data[&#39;scheduled_datetime&#39;] as Timestamp).toDate()<br>          : null,<br>      createdAt: (data[&#39;created_at&#39;] as Timestamp).toDate(),<br>      id: doc.id,<br>    );<br>  }<br><br>  Map&lt;String, dynamic&gt; toMap() {<br>    return {<br>      &#39;distance&#39;: distance,<br>      &#39;duration&#39;: duration,<br>      &#39;user_name&#39;: username,<br>      &#39;user_phone&#39;: userphone,<br>      &#39;status&#39;: status,<br>      &#39;user_image&#39;: userimage,<br>      &#39;pickup&#39;: pickup,<br>      &#39;destination&#39;: destination,<br>      &#39;timestamp&#39;: Timestamp.fromDate(timestamp),<br>      &#39;total_amount&#39;: totalAmount,<br>      &#39;start_latitude&#39;: startLatitude,<br>      &#39;start_longitude&#39;: startLongitude,<br>      &#39;end_latitude&#39;: endLatitude,<br>      &#39;end_longitude&#39;: endLongitude,<br>      &#39;accepted_driver_id&#39;: acceptedDriverId,<br>      &#39;trip_type&#39;: tripType,<br>      &#39;is_scheduled&#39;: isScheduled,<br>      &#39;scheduled_datetime&#39;: scheduledDatetime != null<br>          ? Timestamp.fromDate(scheduledDatetime!)<br>          : null,<br>      &#39;created_at&#39;: Timestamp.fromDate(createdAt),<br>    };<br>  }<br>}<br><br>class DirectionsController extends GetxController {<br>  var directionsList = &lt;DirectionData&gt;[].obs;<br>  var directionsAcceptedList = &lt;DirectionData&gt;[].obs;<br>  var isLoading = false.obs;<br><br>  @override<br>  void onInit() {<br>    fetchDirections();<br>    fetchDirectionsAccepted();<br>    super.onInit();<br>  }<br><br>  void fetchDirections() {<br>    isLoading.value = true;<br>    print(&#39;Starting to fetch directions...&#39;);<br><br>    try {<br>      // Simple query without orderBy first to test<br>      FirebaseFirestore.instance<br>          .collection(&#39;directions_data&#39;)<br>          .where(&#39;status&#39;, isEqualTo: &#39;Requested&#39;)<br>          .snapshots()<br>          .listen((snapshot) {<br>        print(&#39;Snapshot received: ${snapshot.docs.length} documents&#39;);<br><br>        try {<br>          List&lt;DirectionData&gt; directions = [];<br><br>          for (var doc in snapshot.docs) {<br>            print(&#39;Processing document ID: ${doc.id}&#39;);<br>            print(&#39;Document data: ${doc.data()}&#39;);<br><br>            // Check if accepted_driver_id is null or empty<br>            var acceptedDriverId = doc.data()[&#39;accepted_driver_id&#39;];<br>            print(&#39;accepted_driver_id: $acceptedDriverId&#39;);<br><br>            if (acceptedDriverId == null) {<br>              try {<br>                var directionData = DirectionData.fromDocumentSnapshot(doc);<br>                directions.add(directionData);<br>                print(&#39;Added ride: ${directionData.pickup} → ${directionData.destination}&#39;);<br>              } catch (e) {<br>                print(&#39;Error parsing individual document ${doc.id}: $e&#39;);<br>              }<br>            }<br>          }<br><br>          directionsList.assignAll(directions);<br>          isLoading.value = false;<br><br>          print(&#39;Final directions count: ${directions.length}&#39;);<br>          print(&#39;Observable list count: ${directionsList.length}&#39;);<br><br>        } catch (e) {<br>          print(&#39;Error processing documents: $e&#39;);<br>          isLoading.value = false;<br>          Get.snackbar(&#39;Error&#39;, &#39;Failed to process ride data: $e&#39;);<br>        }<br>      }, onError: (e) {<br>        print(&#39;Firestore listen error: $e&#39;);<br>        isLoading.value = false;<br>        Get.snackbar(&#39;Error&#39;, &#39;Failed to fetch directions: $e&#39;);<br>      });<br>    } catch (e) {<br>      print(&#39;Setup error: $e&#39;);<br>      isLoading.value = false;<br>      Get.snackbar(&#39;Error&#39;, &#39;Failed to setup directions listener: $e&#39;);<br>    }<br>  }<br><br>  void fetchDirectionsAccepted() {<br>    final currentUserId = FirebaseAuth.instance.currentUser?.uid;<br><br>    if (currentUserId == null) {<br>      print(&#39;No authenticated user found&#39;);<br>      return;<br>    }<br><br>    try {<br>      FirebaseFirestore.instance<br>          .collection(&#39;directions_data&#39;)<br>          .where(&#39;accepted_driver_id&#39;, isEqualTo: currentUserId)<br>          .where(&#39;status&#39;, isEqualTo: &#39;Accepted&#39;)<br>          .orderBy(&#39;created_at&#39;, descending: true)<br>          .snapshots()<br>          .listen((snapshot) {<br>        try {<br>          var directions = snapshot.docs.map((doc) {<br>            print(&#39;Accepted ride data: ${doc.data()}&#39;);<br>            return DirectionData.fromDocumentSnapshot(doc);<br>          }).toList();<br><br>          directionsAcceptedList.assignAll(directions);<br><br>          print(&#39;Fetched ${directions.length} accepted rides&#39;);<br>        } catch (e) {<br>          print(&#39;Error parsing accepted rides: $e&#39;);<br>          Get.snackbar(&#39;Error&#39;, &#39;Failed to parse accepted rides: $e&#39;);<br>        }<br>      }, onError: (e) {<br>        print(&#39;Failed to fetch accepted directions: $e&#39;);<br>        Get.snackbar(&#39;Error&#39;, &#39;Failed to fetch accepted directions: $e&#39;);<br>      });<br>    } catch (e) {<br>      print(&#39;Error setting up accepted directions listener: $e&#39;);<br>      Get.snackbar(&#39;Error&#39;, &#39;Failed to setup accepted directions listener: $e&#39;);<br>    }<br>  }<br><br>  // Method to accept a ride<br>  Future&lt;void&gt; acceptRide(String rideId) async {<br>    try {<br>      final currentUserId = FirebaseAuth.instance.currentUser?.uid;<br>      if (currentUserId == null) {<br>        Get.snackbar(&#39;Error&#39;, &#39;Please login first&#39;);<br>        return;<br>      }<br><br>      await FirebaseFirestore.instance<br>          .collection(&#39;directions_data&#39;)<br>          .doc(rideId)<br>          .update({<br>        &#39;accepted_driver_id&#39;: currentUserId,<br>        &#39;status&#39;: &#39;Accepted&#39;,<br>      });<br>      Get.to(DriverCallReached(ride: rideId.toString(),));<br><br>      Get.snackbar(&#39;Success&#39;, &#39;Ride accepted successfully!&#39;);<br>    } catch (e) {<br>      print(&#39;Error accepting ride: $e&#39;);<br>      Get.snackbar(&#39;Error&#39;, &#39;Failed to accept ride: $e&#39;);<br>    }<br>  }<br><br>  // Method to complete a ride<br>  Future&lt;void&gt; completeRide(String rideId) async {<br>    try {<br>      await FirebaseFirestore.instance<br>          .collection(&#39;directions_data&#39;)<br>          .doc(rideId)<br>          .update({<br>        &#39;status&#39;: &#39;Completed&#39;,<br>      });<br><br>      Get.snackbar(&#39;Success&#39;, &#39;Ride completed successfully!&#39;);<br>    } catch (e) {<br>      print(&#39;Error completing ride: $e&#39;);<br>      Get.snackbar(&#39;Error&#39;, &#39;Failed to complete ride: $e&#39;);<br>    }<br>  }<br><br>  // Method to cancel a ride<br>  Future&lt;void&gt; cancelRide(String rideId) async {<br>    try {<br>      await FirebaseFirestore.instance<br>          .collection(&#39;directions_data&#39;)<br>          .doc(rideId)<br>          .update({<br>        &#39;status&#39;: &#39;Cancelled&#39;,<br>        &#39;accepted_driver_id&#39;: null,<br>      });<br><br>      Get.snackbar(&#39;Success&#39;, &#39;Ride cancelled successfully!&#39;);<br>    } catch (e) {<br>      print(&#39;Error cancelling ride: $e&#39;);<br>      Get.snackbar(&#39;Error&#39;, &#39;Failed to cancel ride: $e&#39;);<br>    }<br>  }<br><br>  @override<br>  void onClose() {<br>    super.onClose();<br>  }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1edcf80b2178" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DirectionControler]]></title>
            <link>https://sandeepkumaredugaon.medium.com/directioncontroler-1bf2a7807216?source=rss-0fc1a07cda66------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bf2a7807216</guid>
            <dc:creator><![CDATA[Sandeep Kumar]]></dc:creator>
            <pubDate>Sat, 19 Jul 2025 01:11:31 GMT</pubDate>
            <atom:updated>2025-07-19T01:11:31.867Z</atom:updated>
            <content:encoded><![CDATA[<pre><br>class DirectionData {<br>  final String distance;<br>  final String duration;<br>  final String username;<br>  final String status;<br>  final String userphone;<br>  final String pickup;<br>  final String? userimage;<br>  final String destination;<br>  final double totalAmount;<br>  final DateTime timestamp;<br>  final double startLatitude;<br>  final double startLongitude;<br>  final double endLatitude;<br>  final double endLongitude;<br>  final String id;<br>  final String tripType;<br>  final bool isScheduled;<br>  final DateTime? scheduledDatetime;<br>  final DateTime createdAt;<br>  String? acceptedDriverId;<br><br>  DirectionData({<br>    required this.distance,<br>    required this.duration,<br>    required this.username,<br>    required this.status,<br>    required this.userphone,<br>    required this.userimage,<br>    required this.totalAmount,<br>    required this.pickup,<br>    required this.destination,<br>    required this.timestamp,<br>    required this.startLatitude,<br>    required this.startLongitude,<br>    required this.endLatitude,<br>    required this.endLongitude,<br>    required this.id,<br>    required this.tripType,<br>    required this.isScheduled,<br>    required this.createdAt,<br>    this.scheduledDatetime,<br>    this.acceptedDriverId,<br>  });<br><br>  // Factory constructor from Firestore DocumentSnapshot<br>  factory DirectionData.fromDocumentSnapshot(DocumentSnapshot doc) {<br>    final data = doc.data() as Map&lt;String, dynamic&gt;;<br><br>    return DirectionData(<br>      distance: data[&#39;distance&#39;] as String? ?? &#39;&#39;,<br>      duration: data[&#39;duration&#39;] as String? ?? &#39;&#39;,<br>      username: data[&#39;user_name&#39;] as String? ?? &#39;&#39;,<br>      userphone: data[&#39;user_phone&#39;] as String? ?? &#39;&#39;,<br>      status: data[&#39;status&#39;] as String? ?? &#39;Requested&#39;,<br>      userimage: data[&#39;user_image&#39;] as String?,<br>      pickup: data[&#39;pickup&#39;] as String? ?? &#39;&#39;,<br>      destination: data[&#39;destination&#39;] as String? ?? &#39;&#39;,<br>      timestamp: _parseTimestamp(data[&#39;timestamp&#39;]),<br>      totalAmount: (data[&#39;total_amount&#39;] as num?)?.toDouble() ?? 0.0,<br>      startLatitude: (data[&#39;start_latitude&#39;] as num?)?.toDouble() ?? 0.0,<br>      startLongitude: (data[&#39;start_longitude&#39;] as num?)?.toDouble() ?? 0.0,<br>      endLatitude: (data[&#39;end_latitude&#39;] as num?)?.toDouble() ?? 0.0,<br>      endLongitude: (data[&#39;end_longitude&#39;] as num?)?.toDouble() ?? 0.0,<br>      acceptedDriverId: data[&#39;accepted_driver_id&#39;] as String?,<br>      id: doc.id,<br>      tripType: data[&#39;trip_type&#39;] as String? ?? &#39;One Way&#39;,<br>      isScheduled: data[&#39;is_scheduled&#39;] as bool? ?? false,<br>      scheduledDatetime: _parseTimestamp(data[&#39;scheduled_datetime&#39;]),<br>      createdAt: _parseTimestamp(data[&#39;created_at&#39;]),<br>    );<br>  }<br><br>  // Factory constructor from Map (for JSON conversion)<br>  factory DirectionData.fromMap(Map&lt;String, dynamic&gt; map, String docId) {<br>    return DirectionData(<br>      distance: map[&#39;distance&#39;] as String? ?? &#39;&#39;,<br>      duration: map[&#39;duration&#39;] as String? ?? &#39;&#39;,<br>      username: map[&#39;user_name&#39;] as String? ?? &#39;&#39;,<br>      userphone: map[&#39;user_phone&#39;] as String? ?? &#39;&#39;,<br>      status: map[&#39;status&#39;] as String? ?? &#39;Requested&#39;,<br>      userimage: map[&#39;user_image&#39;] as String?,<br>      pickup: map[&#39;pickup&#39;] as String? ?? &#39;&#39;,<br>      destination: map[&#39;destination&#39;] as String? ?? &#39;&#39;,<br>      timestamp: _parseTimestamp(map[&#39;timestamp&#39;]),<br>      totalAmount: (map[&#39;total_amount&#39;] as num?)?.toDouble() ?? 0.0,<br>      startLatitude: (map[&#39;start_latitude&#39;] as num?)?.toDouble() ?? 0.0,<br>      startLongitude: (map[&#39;start_longitude&#39;] as num?)?.toDouble() ?? 0.0,<br>      endLatitude: (map[&#39;end_latitude&#39;] as num?)?.toDouble() ?? 0.0,<br>      endLongitude: (map[&#39;end_longitude&#39;] as num?)?.toDouble() ?? 0.0,<br>      acceptedDriverId: map[&#39;accepted_driver_id&#39;] as String?,<br>      id: docId,<br>      tripType: map[&#39;trip_type&#39;] as String? ?? &#39;One Way&#39;,<br>      isScheduled: map[&#39;is_scheduled&#39;] as bool? ?? false,<br>      scheduledDatetime: _parseTimestamp(map[&#39;scheduled_datetime&#39;]),<br>      createdAt: _parseTimestamp(map[&#39;created_at&#39;]),<br>    );<br>  }<br><br>  // Convert to Map for Firestore<br>  Map&lt;String, dynamic&gt; toMap() {<br>    return {<br>      &#39;distance&#39;: distance,<br>      &#39;duration&#39;: duration,<br>      &#39;user_name&#39;: username,<br>      &#39;user_phone&#39;: userphone,<br>      &#39;status&#39;: status,<br>      &#39;user_image&#39;: userimage,<br>      &#39;pickup&#39;: pickup,<br>      &#39;destination&#39;: destination,<br>      &#39;timestamp&#39;: Timestamp.fromDate(timestamp),<br>      &#39;total_amount&#39;: totalAmount,<br>      &#39;start_latitude&#39;: startLatitude,<br>      &#39;start_longitude&#39;: startLongitude,<br>      &#39;end_latitude&#39;: endLatitude,<br>      &#39;end_longitude&#39;: endLongitude,<br>      &#39;accepted_driver_id&#39;: acceptedDriverId,<br>      &#39;trip_type&#39;: tripType,<br>      &#39;is_scheduled&#39;: isScheduled,<br>      &#39;scheduled_datetime&#39;: scheduledDatetime != null<br>          ? Timestamp.fromDate(scheduledDatetime!)<br>          : null,<br>      &#39;created_at&#39;: Timestamp.fromDate(createdAt),<br>    };<br>  }<br><br>  // Helper method to parse timestamp safely<br>  static DateTime _parseTimestamp(dynamic timestamp) {<br>    if (timestamp == null) return DateTime.now();<br>    if (timestamp is Timestamp) return timestamp.toDate();<br>    if (timestamp is DateTime) return timestamp;<br>    return DateTime.now();<br>  }<br><br>  // Copy with method for immutable updates<br>  DirectionData copyWith({<br>    String? distance,<br>    String? duration,<br>    String? username,<br>    String? status,<br>    String? userphone,<br>    String? userimage,<br>    String? pickup,<br>    String? destination,<br>    double? totalAmount,<br>    DateTime? timestamp,<br>    double? startLatitude,<br>    double? startLongitude,<br>    double? endLatitude,<br>    double? endLongitude,<br>    String? id,<br>    String? tripType,<br>    bool? isScheduled,<br>    DateTime? scheduledDatetime,<br>    DateTime? createdAt,<br>    String? acceptedDriverId,<br>  }) {<br>    return DirectionData(<br>      distance: distance ?? this.distance,<br>      duration: duration ?? this.duration,<br>      username: username ?? this.username,<br>      status: status ?? this.status,<br>      userphone: userphone ?? this.userphone,<br>      userimage: userimage ?? this.userimage,<br>      pickup: pickup ?? this.pickup,<br>      destination: destination ?? this.destination,<br>      totalAmount: totalAmount ?? this.totalAmount,<br>      timestamp: timestamp ?? this.timestamp,<br>      startLatitude: startLatitude ?? this.startLatitude,<br>      startLongitude: startLongitude ?? this.startLongitude,<br>      endLatitude: endLatitude ?? this.endLatitude,<br>      endLongitude: endLongitude ?? this.endLongitude,<br>      id: id ?? this.id,<br>      tripType: tripType ?? this.tripType,<br>      isScheduled: isScheduled ?? this.isScheduled,<br>      scheduledDatetime: scheduledDatetime ?? this.scheduledDatetime,<br>      createdAt: createdAt ?? this.createdAt,<br>      acceptedDriverId: acceptedDriverId ?? this.acceptedDriverId,<br>    );<br>  }<br><br>  @override<br>  String toString() {<br>    return &#39;DirectionData{id: $id, username: $username, status: $status, distance: $distance, destination: $destination, acceptedDriverId: $acceptedDriverId}&#39;;<br>  }<br><br>  @override<br>  bool operator ==(Object other) =&gt;<br>      identical(this, other) ||<br>          other is DirectionData &amp;&amp; runtimeType == other.runtimeType &amp;&amp; id == other.id;<br><br>  @override<br>  int get hashCode =&gt; id.hashCode;<br>}<br><br>class DirectionsController extends GetxController {<br>  var directionsList = &lt;DirectionData&gt;[].obs;<br>  var directionsAcceptedList = &lt;DirectionData&gt;[].obs;<br>  var isLoading = false.obs;<br>  var error = &#39;&#39;.obs;<br><br>  // Collection reference for better maintainability<br>  static const String _collectionName = &#39;directions_data&#39;;<br><br>  CollectionReference get _directionsCollection =&gt;<br>      FirebaseFirestore.instance.collection(_collectionName);<br><br>  @override<br>  void onInit() {<br>    super.onInit();<br>    fetchDirections();<br>    fetchDirectionsAccepted();<br>  }<br><br>  // Fetch available directions (not accepted by any driver)<br>  void fetchDirections() {<br>    isLoading.value = true;<br>    error.value = &#39;&#39;;<br><br>    _directionsCollection<br>        .where(&#39;status&#39;, isEqualTo: &#39;Requested&#39;)<br>        .where(&#39;accepted_driver_id&#39;, isNull: true)<br>        .orderBy(&#39;created_at&#39;, descending: true)<br>        .snapshots()<br>        .listen(<br>          (snapshot) {<br>        try {<br>          print(&#39;📱 Fetched ${snapshot.docs.length} available directions&#39;);<br><br>          var directions = snapshot.docs.map((doc) {<br>            print(&#39;📄 Processing document: ${doc.id}&#39;);<br>            return DirectionData.fromDocumentSnapshot(doc);<br>          }).toList();<br><br>          directionsList.value = directions;<br>          isLoading.value = false;<br><br>          print(&#39;✅ Successfully loaded ${directions.length} directions&#39;);<br>          _logDirectionsList();<br><br>        } catch (e) {<br>          print(&#39;❌ Error processing directions: $e&#39;);<br>          error.value = &#39;Error processing directions: $e&#39;;<br>          isLoading.value = false;<br>        }<br>      },<br>      onError: (e) {<br>        print(&#39;❌ Firebase error: $e&#39;);<br>        error.value = &#39;Failed to fetch directions: $e&#39;;<br>        isLoading.value = false;<br>        Get.snackbar(<br>          &#39;Error&#39;,<br>          &#39;Failed to fetch directions: $e&#39;,<br>          backgroundColor: Colors.red.withOpacity(0.1),<br>          colorText: Colors.red,<br>        );<br>      },<br>    );<br>  }<br><br>  // Fetch directions accepted by current driver<br>  void fetchDirectionsAccepted() {<br>    final currentUserId = FirebaseAuth.instance.currentUser?.uid;<br>    if (currentUserId == null) {<br>      print(&#39;⚠️ No authenticated user found&#39;);<br>      return;<br>    }<br><br>    _directionsCollection<br>        .where(&#39;accepted_driver_id&#39;, isEqualTo: currentUserId)<br>        .where(&#39;status&#39;, isEqualTo: &#39;Accepted&#39;)<br>        .orderBy(&#39;created_at&#39;, descending: true)<br>        .snapshots()<br>        .listen(<br>          (snapshot) {<br>        try {<br>          print(&#39;🚗 Fetched ${snapshot.docs.length} accepted directions&#39;);<br><br>          var directions = snapshot.docs.map((doc) {<br>            return DirectionData.fromDocumentSnapshot(doc);<br>          }).toList();<br><br>          directionsAcceptedList.assignAll(directions);<br>          print(&#39;✅ Successfully loaded ${directions.length} accepted directions&#39;);<br><br>        } catch (e) {<br>          print(&#39;❌ Error processing accepted directions: $e&#39;);<br>        }<br>      },<br>      onError: (e) {<br>        print(&#39;❌ Firebase error for accepted directions: $e&#39;);<br>        Get.snackbar(<br>          &#39;Error&#39;,<br>          &#39;Failed to fetch accepted directions: $e&#39;,<br>          backgroundColor: Colors.red.withOpacity(0.1),<br>          colorText: Colors.red,<br>        );<br>      },<br>    );<br>  }<br><br>  // Accept a direction/ride<br>  Future&lt;void&gt; acceptDirection(String directionId) async {<br>    final currentUserId = FirebaseAuth.instance.currentUser?.uid;<br>    if (currentUserId == null) {<br>      Get.snackbar(&#39;Error&#39;, &#39;Please login first&#39;);<br>      return;<br>    }<br><br>    try {<br>      await _directionsCollection.doc(directionId).update({<br>        &#39;accepted_driver_id&#39;: currentUserId,<br>        &#39;status&#39;: &#39;Accepted&#39;,<br>      });<br><br>      Get.snackbar(<br>        &#39;Success&#39;,<br>        &#39;Ride accepted successfully!&#39;,<br>        backgroundColor: Colors.green.withOpacity(0.1),<br>        colorText: Colors.green,<br>      );<br>    } catch (e) {<br>      print(&#39;❌ Error accepting direction: $e&#39;);<br>      Get.snackbar(&#39;Error&#39;, &#39;Failed to accept ride: $e&#39;);<br>    }<br>  }<br><br>  // Complete a ride<br>  Future&lt;void&gt; completeDirection(String directionId) async {<br>    try {<br>      await _directionsCollection.doc(directionId).update({<br>        &#39;status&#39;: &#39;Completed&#39;,<br>      });<br><br>      Get.snackbar(<br>        &#39;Success&#39;,<br>        &#39;Ride completed successfully!&#39;,<br>        backgroundColor: Colors.green.withOpacity(0.1),<br>        colorText: Colors.green,<br>      );<br>    } catch (e) {<br>      print(&#39;❌ Error completing direction: $e&#39;);<br>      Get.snackbar(&#39;Error&#39;, &#39;Failed to complete ride: $e&#39;);<br>    }<br>  }<br><br>  // Cancel a ride<br>  Future&lt;void&gt; cancelDirection(String directionId) async {<br>    try {<br>      await _directionsCollection.doc(directionId).update({<br>        &#39;status&#39;: &#39;Cancelled&#39;,<br>        &#39;accepted_driver_id&#39;: null,<br>      });<br><br>      Get.snackbar(<br>        &#39;Success&#39;,<br>        &#39;Ride cancelled successfully!&#39;,<br>        backgroundColor: Colors.orange.withOpacity(0.1),<br>        colorText: Colors.orange,<br>      );<br>    } catch (e) {<br>      print(&#39;❌ Error cancelling direction: $e&#39;);<br>      Get.snackbar(&#39;Error&#39;, &#39;Failed to cancel ride: $e&#39;);<br>    }<br>  }<br><br>  // Refresh all data<br>  void refreshData() {<br>    print(&#39;🔄 Refreshing all directions data...&#39;);<br>    fetchDirections();<br>    fetchDirectionsAccepted();<br>  }<br><br>  // Get directions by status<br>  List&lt;DirectionData&gt; getDirectionsByStatus(String status) {<br>    return directionsList.where((direction) =&gt; direction.status == status).toList();<br>  }<br><br>  // Get nearby directions (if you have location logic)<br>  Future&lt;List&lt;DirectionData&gt;&gt; getNearbyDirections(<br>      double currentLat,<br>      double currentLng,<br>      {double radiusInKm = 10}<br>      ) async {<br>    // This would require additional logic for distance calculation<br>    // For now, returning all available directions<br>    return directionsList.toList();<br>  }<br><br>  // Debug logging<br>  void _logDirectionsList() {<br>    print(&#39;📋 Current directions list:&#39;);<br>    for (int i = 0; i &lt; directionsList.length; i++) {<br>      final direction = directionsList[i];<br>      print(&#39;  ${i + 1}. ${direction.toString()}&#39;);<br>    }<br>  }<br><br>  @override<br>  void onClose() {<br>    // Clean up if needed<br>    super.onClose();<br>  }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bf2a7807216" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WebView in Flutter]]></title>
            <link>https://sandeepkumaredugaon.medium.com/webview-in-flutter-139ceb6509bf?source=rss-0fc1a07cda66------2</link>
            <guid isPermaLink="false">https://medium.com/p/139ceb6509bf</guid>
            <dc:creator><![CDATA[Sandeep Kumar]]></dc:creator>
            <pubDate>Thu, 17 Jul 2025 15:54:26 GMT</pubDate>
            <atom:updated>2025-07-17T15:54:26.008Z</atom:updated>
            <content:encoded><![CDATA[<pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:webview_flutter/webview_flutter.dart&#39;;<br><br>class WebviewScreen extends StatefulWidget {<br>  const WebviewScreen({Key? key}) : super(key: key);<br><br>  @override<br>  State&lt;WebviewScreen&gt; createState() =&gt; _WebviewScreenState();<br>}<br><br>class _WebviewScreenState extends State&lt;WebviewScreen&gt; {<br>  late final WebViewController _controller;<br><br>  @override<br>  void initState() {<br>    super.initState();<br>    _controller = WebViewController()<br>      ..setJavaScriptMode(JavaScriptMode.unrestricted)<br>      ..loadRequest(Uri.parse(&#39;https://affiliateformarketing.com/&#39;));<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      body: SafeArea(<br>        child: WebViewWidget(controller: _controller),<br>      ),<br>    );<br>  }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=139ceb6509bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Add Car]]></title>
            <link>https://sandeepkumaredugaon.medium.com/add-car-32499f2a9e99?source=rss-0fc1a07cda66------2</link>
            <guid isPermaLink="false">https://medium.com/p/32499f2a9e99</guid>
            <dc:creator><![CDATA[Sandeep Kumar]]></dc:creator>
            <pubDate>Sun, 22 Jun 2025 08:22:23 GMT</pubDate>
            <atom:updated>2025-06-22T08:22:23.233Z</atom:updated>
            <content:encoded><![CDATA[<pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:cloud_firestore/cloud_firestore.dart&#39;;<br>import &#39;package:image_picker/image_picker.dart&#39;;<br>import &#39;package:firebase_storage/firebase_storage.dart&#39;;<br>import &#39;dart:io&#39;;<br><br>class AddCarPage extends StatefulWidget {<br>  @override<br>  _AddCarPageState createState() =&gt; _AddCarPageState();<br>}<br><br>class _AddCarPageState extends State&lt;AddCarPage&gt; {<br>  final _formKey = GlobalKey&lt;FormState&gt;();<br>  final TextEditingController nameController = TextEditingController();<br>  final TextEditingController yearController = TextEditingController();<br>  final TextEditingController kmsController = TextEditingController();<br>  final TextEditingController fuelController = TextEditingController();<br>  final TextEditingController priceController = TextEditingController();<br>  final TextEditingController ownershipController = TextEditingController();<br>  final TextEditingController phoneController = TextEditingController();<br>  final TextEditingController descriptionController = TextEditingController();<br><br><br><br>  File? _image;<br>  bool _isLoading = false;<br><br>  Future&lt;void&gt; pickImage() async {<br>    final picked = await ImagePicker().pickImage(source: ImageSource.gallery);<br>    if (picked != null) {<br>      setState(() {<br>        _image = File(picked.path);<br>      });<br>    }<br>  }<br><br>  Future&lt;void&gt; addCarToFirebase() async {<br>    if (_formKey.currentState!.validate() &amp;&amp; _image != null) {<br>      setState(() {<br>        _isLoading = true;<br>      });<br><br>      try {<br>        final fileName = DateTime.now().millisecondsSinceEpoch.toString();<br>        final ref = FirebaseStorage.instance.ref().child(&#39;car_images/$fileName&#39;);<br>        await ref.putFile(_image!);<br>        final imageUrl = await ref.getDownloadURL();<br><br>        await FirebaseFirestore.instance.collection(&#39;cars&#39;).add({<br>          &#39;name&#39;: nameController.text,<br>          &#39;year&#39;: int.parse(yearController.text),<br>          &#39;kmsDriven&#39;: int.parse(kmsController.text),<br>          &#39;fuel&#39;: fuelController.text,<br>          &#39;price&#39;: int.parse(priceController.text),<br>          &#39;ownership&#39;: ownershipController.text,<br>          &#39;phonenumber&#39;: phoneController.text,<br>          &#39;description&#39;: descriptionController.text,<br>          &#39;imageUrl&#39;: imageUrl,<br>        });<br><br>        ScaffoldMessenger.of(context).showSnackBar(<br>          SnackBar(<br>            content: Row(<br>              children: [<br>                Icon(Icons.check_circle, color: Colors.white),<br>                SizedBox(width: 8),<br>                Text(&#39;Car added successfully!&#39;),<br>              ],<br>            ),<br>            backgroundColor: Colors.green,<br>          ),<br>        );<br>        Navigator.pop(context);<br>      } catch (e) {<br>        ScaffoldMessenger.of(context).showSnackBar(<br>          SnackBar(<br>            content: Text(&#39;Error: $e&#39;),<br>            backgroundColor: Colors.red,<br>          ),<br>        );<br>      } finally {<br>        setState(() {<br>          _isLoading = false;<br>        });<br>      }<br>    } else if (_image == null) {<br>      ScaffoldMessenger.of(context).showSnackBar(<br>        SnackBar(<br>          content: Text(&#39;Please select a car image&#39;),<br>          backgroundColor: Colors.orange,<br>        ),<br>      );<br>    }<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(<br>        title: Text(&quot;Add New Car&quot;),<br>        elevation: 0,<br>        backgroundColor: Colors.blue[800],<br>      ),<br>      body: _isLoading<br>          ? Center(<br>        child: Column(<br>          mainAxisAlignment: MainAxisAlignment.center,<br>          children: [<br>            CircularProgressIndicator(),<br>            SizedBox(height: 16),<br>            Text(&#39;Adding car...&#39;, style: TextStyle(fontSize: 16)),<br>          ],<br>        ),<br>      )<br>          : SingleChildScrollView(<br>        padding: EdgeInsets.all(16),<br>        child: Form(<br>          key: _formKey,<br>          child: Column(<br>            crossAxisAlignment: CrossAxisAlignment.start,<br>            children: [<br>              Text(<br>                &#39;Car Information&#39;,<br>                style: TextStyle(<br>                  fontSize: 22,<br>                  fontWeight: FontWeight.bold,<br>                  color: Colors.blue[800],<br>                ),<br>              ),<br>              SizedBox(height: 20),<br>              GestureDetector(<br>                onTap: pickImage,<br>                child: Container(<br>                  height: 200,<br>                  width: double.infinity,<br>                  decoration: BoxDecoration(<br>                    color: Colors.grey[200],<br>                    borderRadius: BorderRadius.circular(12),<br>                    border: Border.all(color: Colors.grey[400]!),<br>                  ),<br>                  child: _image == null<br>                      ? Column(<br>                    mainAxisAlignment: MainAxisAlignment.center,<br>                    children: [<br>                      Icon(Icons.add_a_photo, size: 50, color: Colors.blue[800]),<br>                      SizedBox(height: 10),<br>                      Text(<br>                        &quot;Select Car Image&quot;,<br>                        style: TextStyle(color: Colors.blue[800], fontWeight: FontWeight.bold),<br>                      ),<br>                    ],<br>                  )<br>                      : ClipRRect(<br>                    borderRadius: BorderRadius.circular(12),<br>                    child: Image.file(_image!, height: 200, width: double.infinity, fit: BoxFit.cover),<br>                  ),<br>                ),<br>              ),<br>              SizedBox(height: 24),<br><br>              _buildTextField(<br>                controller: nameController,<br>                label: &quot;Car Name&quot;,<br>                icon: Icons.directions_car,<br>                validator: (v) =&gt; v!.isEmpty ? &#39;Car name is required&#39; : null,<br>              ),<br>              _buildTextField(<br>                controller: descriptionController,<br>                label: &quot;Car Decription&quot;,<br>                icon: Icons.directions_car,<br>                validator: (v) =&gt; v!.isEmpty ? &#39;Car description is required&#39; : null,<br>              ),<br><br>              _buildTextField(<br>                controller: yearController,<br>                label: &quot;Model Year&quot;,<br>                icon: Icons.calendar_today,<br>                keyboardType: TextInputType.number,<br>                validator: (v) =&gt; v!.isEmpty ? &#39;Year is required&#39; : null,<br>              ),<br><br>              _buildTextField(<br>                controller: kmsController,<br>                label: &quot;Kilometers Driven&quot;,<br>                icon: Icons.speed,<br>                keyboardType: TextInputType.number,<br>                validator: (v) =&gt; v!.isEmpty ? &#39;Kilometers is required&#39; : null,<br>              ),<br><br>              _buildTextField(<br>                controller: fuelController,<br>                label: &quot;Fuel Type&quot;,<br>                icon: Icons.local_gas_station,<br>                validator: (v) =&gt; v!.isEmpty ? &#39;Fuel type is required&#39; : null,<br>              ),<br><br>              _buildTextField(<br>                controller: priceController,<br>                label: &quot;Price (₹)&quot;,<br>                icon: Icons.currency_rupee,<br>                keyboardType: TextInputType.number,<br>                validator: (v) =&gt; v!.isEmpty ? &#39;Price is required&#39; : null,<br>              ),<br><br>              _buildTextField(<br>                controller: ownershipController,<br>                label: &quot;Ownership&quot;,<br>                icon: Icons.person,<br>                validator: (v) =&gt; v!.isEmpty ? &#39;Ownership is required&#39; : null,<br>              ),<br><br>              _buildTextField(<br>                controller: phoneController,<br>                label: &quot;Phone Number&quot;,<br>                icon: Icons.phone,<br>                keyboardType: TextInputType.phone,<br>                validator: (v) =&gt; v!.isEmpty ? &#39;Phone number is required&#39; : null,<br>              ),<br><br>              SizedBox(height: 32),<br>              SizedBox(<br>                width: double.infinity,<br>                height: 54,<br>                child: ElevatedButton(<br>                  onPressed: addCarToFirebase,<br>                  style: ElevatedButton.styleFrom(<br>                    backgroundColor: Colors.blue[800],<br>                    foregroundColor: Colors.white,<br>                    elevation: 3,<br>                    shape: RoundedRectangleBorder(<br>                      borderRadius: BorderRadius.circular(12),<br>                    ),<br>                  ),<br>                  child: Text(<br>                    &quot;ADD CAR&quot;,<br>                    style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),<br>                  ),<br>                ),<br>              ),<br>              SizedBox(height: 20),<br>            ],<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br><br>  Widget _buildTextField({<br>    required TextEditingController controller,<br>    required String label,<br>    required IconData icon,<br>    TextInputType keyboardType = TextInputType.text,<br>    String? Function(String?)? validator,<br>  }) {<br>    return Padding(<br>      padding: const EdgeInsets.only(bottom: 16),<br>      child: TextFormField(<br>        controller: controller,<br>        keyboardType: keyboardType,<br>        decoration: InputDecoration(<br>          labelText: label,<br>          prefixIcon: Icon(icon, color: Colors.blue[800]),<br>          border: OutlineInputBorder(<br>            borderRadius: BorderRadius.circular(10),<br>            borderSide: BorderSide(color: Colors.grey[400]!),<br>          ),<br>          enabledBorder: OutlineInputBorder(<br>            borderRadius: BorderRadius.circular(10),<br>            borderSide: BorderSide(color: Colors.grey[400]!),<br>          ),<br>          focusedBorder: OutlineInputBorder(<br>            borderRadius: BorderRadius.circular(10),<br>            borderSide: BorderSide(color: Colors.blue[800]!, width: 2),<br>          ),<br>          filled: true,<br>          fillColor: Colors.grey[100],<br>        ),<br>        validator: validator,<br>      ),<br>    );<br>  }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32499f2a9e99" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[male femal list]]></title>
            <link>https://sandeepkumaredugaon.medium.com/male-femal-list-70e63f92b7b2?source=rss-0fc1a07cda66------2</link>
            <guid isPermaLink="false">https://medium.com/p/70e63f92b7b2</guid>
            <dc:creator><![CDATA[Sandeep Kumar]]></dc:creator>
            <pubDate>Mon, 09 Jun 2025 05:13:54 GMT</pubDate>
            <atom:updated>2025-06-09T05:13:54.803Z</atom:updated>
            <content:encoded><![CDATA[<pre>  Widget _buildMatchesList(String searchQuery) {<br>    final currentUserUid = FirebaseAuth.instance.currentUser?.uid;<br><br>    return StreamBuilder&lt;QuerySnapshot&gt;(<br>      stream: FirebaseFirestore.instance.collection(&#39;users&#39;).snapshots(),<br>      builder: (context, snapshot) {<br>        if (snapshot.hasError) {<br>          return Center(child: Text(&quot;Something went wrong&quot;));<br>        }<br><br>        if (snapshot.connectionState == ConnectionState.waiting) {<br>          return Center(child: CircularProgressIndicator());<br>        }<br><br>        final allUsers = snapshot.data!.docs;<br><br>        // पहले current user का gender find करें<br>        String? currentUserGender;<br>        for (var doc in allUsers) {<br>          final data = doc.data() as Map&lt;String, dynamic&gt;;<br>          if (data[&#39;uid&#39;] == currentUserUid) {<br>            currentUserGender = data[&#39;gender&#39;]?.toString().toLowerCase();<br>            break;<br>          }<br>        }<br><br>        final filteredUsers = allUsers.where((doc) {<br>          final data = doc.data() as Map&lt;String, dynamic&gt;;<br>          final uid = data[&#39;uid&#39;];<br><br>          // 👇 Apne aap ko skip karo<br>          if (uid == currentUserUid) return false;<br><br>          // 👇 Gender filter - sirf same gender ke users dikhao<br>          final userGender = (data[&#39;gender&#39;] ?? &#39;&#39;).toString().toLowerCase();<br>          if (currentUserGender != null &amp;&amp; userGender != currentUserGender) {<br>            return false;<br>          }<br><br>          // 👇 Search query filter<br>          final username = (data[&#39;username&#39;] ?? &#39;&#39;).toString().toLowerCase();<br>          final city = (data[&#39;city&#39;] ?? &#39;&#39;).toString().toLowerCase();<br>          final degree = (data[&#39;degree&#39;] ?? &#39;&#39;).toString().toLowerCase();<br>          final hobby = (data[&#39;favorite_hobby&#39;] ?? &#39;&#39;).toString().toLowerCase();<br><br>          final query = searchQuery.toLowerCase();<br><br>          return username.contains(query) ||<br>              city.contains(query) ||<br>              degree.contains(query) ||<br>              hobby.contains(query);<br>        }).toList();<br><br>        if (filteredUsers.isEmpty) {<br>          return Center(child: Text(&quot;No matching users found.&quot;));<br>        }<br><br>        return ListView.builder(<br>          itemCount: filteredUsers.length,<br>          itemBuilder: (context, index) {<br>            final data = filteredUsers[index].data() as Map&lt;String, dynamic&gt;;<br>            return _buildMatchCard(data, index);<br>          },<br>        );<br>      },<br>    );<br>  }</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70e63f92b7b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[homepage car4deal code flutter]]></title>
            <link>https://sandeepkumaredugaon.medium.com/homepage-car4deal-code-flutter-8ee15bd7f275?source=rss-0fc1a07cda66------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ee15bd7f275</guid>
            <dc:creator><![CDATA[Sandeep Kumar]]></dc:creator>
            <pubDate>Mon, 19 May 2025 03:18:35 GMT</pubDate>
            <atom:updated>2025-05-19T03:18:35.857Z</atom:updated>
            <content:encoded><![CDATA[<pre>import &#39;dart:io&#39;;<br>import &#39;package:car4deal/Views/Screen/EmailAuth/LoginPage.dart&#39;;<br>import &#39;package:car4deal/Views/Screen/EmailAuth/try.dart&#39;;<br>import &#39;package:car4deal/Views/Screen/PhoneAUth/VerifyOtp.dart&#39;;<br>import &#39;package:cloud_firestore/cloud_firestore.dart&#39;;<br>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:carousel_slider/carousel_slider.dart&#39;;<br>import &#39;package:cached_network_image/cached_network_image.dart&#39;;<br>import &#39;package:url_launcher/url_launcher.dart&#39;;<br><br>import &#39;../EmailAuth/drawer.dart&#39;;<br>import &#39;PremiumCarCard.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>  final List&lt;String&gt; imageUrls = [<br>    &#39;https://car4deal.com/assets/img/cars/wwwww.webp&#39;,<br>    &#39;https://car4deal.com/admin/uploads/product/fortuner%2001dmghfjf.png&#39;,<br>    &#39;https://car4deal.com/assets/img/cars/5-car4deal.webp&#39;,<br>    &#39;https://car4deal.com/assets/img/cars/ssd-1.png&#39;,<br>    &#39;https://car4deal.com/assets/img/cars/ff-2.webp&#39;,<br>  ];<br><br>  // Add search controller and query string<br>  final TextEditingController _searchController = TextEditingController();<br>  String _searchQuery = &quot;&quot;;<br><br>  @override<br>  void dispose() {<br>    _searchController.dispose();<br>    super.dispose();<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      backgroundColor: Colors.grey[100],<br>      appBar: AppBar(<br>        elevation: 0,<br>        backgroundColor: Colors.white,<br>        actions: [<br>          GestureDetector(<br>            onTap: () {<br>              Navigator.push(context, MaterialPageRoute(builder: (context) =&gt; PhoneAuth(),));<br>            },<br>            child: Container(<br>              margin: const EdgeInsets.only(right: 15),<br>              padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),<br>              decoration: BoxDecoration(<br>                color: Colors.black,<br>                borderRadius: BorderRadius.circular(20),<br>              ),<br>              child: const Text(<br>                &quot;Login&quot;,<br>                style: TextStyle(<br>                  color: Colors.white,<br>                  fontWeight: FontWeight.bold,<br>                  fontSize: 14,<br>                ),<br>              ),<br>            ),<br>          ),<br>        ],<br>        title: SizedBox(<br>          child: Image.asset(<br>            &#39;assets/images/carfodeal.png&#39;,<br>            height: 35,<br>          ),<br>        ),<br>      ),<br>      drawer: const CustomDrawer(),<br>      body: SingleChildScrollView(<br>        child: Column(<br>          crossAxisAlignment: CrossAxisAlignment.start,<br>          children: [<br>            // Hero Section with Search<br>            Container(<br>              padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),<br>              decoration: BoxDecoration(<br>                color: Colors.white,<br>                boxShadow: [<br>                  BoxShadow(<br>                    color: Colors.black.withOpacity(0.05),<br>                    blurRadius: 10,<br>                    offset: const Offset(0, 5),<br>                  ),<br>                ],<br>              ),<br>              child: Column(<br>                crossAxisAlignment: CrossAxisAlignment.start,<br>                children: [<br>                  const Text(<br>                    &quot;Find Your Dream Car&quot;,<br>                    style: TextStyle(<br>                      fontSize: 20,<br>                      fontWeight: FontWeight.bold,<br>                    ),<br>                  ),<br>                  const SizedBox(height: 5),<br>                  Text(<br>                    &quot;Browse through our premium collection&quot;,<br>                    style: TextStyle(<br>                      fontSize: 13,<br>                      color: Colors.grey,<br>                    ),<br>                  ),<br>                  const SizedBox(height: 15),<br>                  Container(<br>                    padding: const EdgeInsets.symmetric(horizontal: 15),<br>                    decoration: BoxDecoration(<br>                      color: Colors.grey[200],<br>                      borderRadius: BorderRadius.circular(12),<br>                    ),<br>                    child: TextField(<br>                      controller: _searchController,<br>                      decoration: InputDecoration(<br>                        border: InputBorder.none,<br>                        hintText: &quot;Search cars, brands...&quot;,<br>                        hintStyle: TextStyle(color: Colors.grey),<br>                        icon: Icon(Icons.search, color: Colors.grey),<br>                        suffixIcon: _searchQuery.isNotEmpty<br>                            ? IconButton(<br>                          icon: Icon(Icons.clear, color: Colors.grey),<br>                          onPressed: () {<br>                            setState(() {<br>                              _searchController.clear();<br>                              _searchQuery = &quot;&quot;;<br>                            });<br>                          },<br>                        )<br>                            : null,<br>                      ),<br>                      onChanged: (value) {<br>                        setState(() {<br>                          _searchQuery = value.trim();<br>                        });<br>                      },<br>                    ),<br>                  ),<br>                ],<br>              ),<br>            ),<br><br>            // Featured Cars Slider (only show when not searching)<br>            if (_searchQuery.isEmpty) ...[<br>              Padding(<br>                padding: const EdgeInsets.only(left: 16, top: 16),<br>                child: const Text(<br>                  &quot;Featured Cars&quot;,<br>                  style: TextStyle(<br>                    fontSize: 19,<br>                    fontWeight: FontWeight.bold,<br>                  ),<br>                ),<br>              ),<br>              const SizedBox(height: 12),<br>              CarouselSlider(<br>                options: CarouselOptions(<br>                  height: 180,<br>                  autoPlay: true,<br>                  enlargeCenterPage: true,<br>                  viewportFraction: 0.85,<br>                  aspectRatio: 16 / 9,<br>                  autoPlayInterval: const Duration(seconds: 3),<br>                ),<br>                items: imageUrls.map((url) {<br>                  return Builder(<br>                    builder: (BuildContext context) {<br>                      return Container(<br>                        width: MediaQuery.of(context).size.width,<br>                        margin: const EdgeInsets.symmetric(horizontal: 5),<br>                        decoration: BoxDecoration(<br>                          borderRadius: BorderRadius.circular(20),<br>                          boxShadow: [<br>                            BoxShadow(<br>                              color: Colors.black.withOpacity(0.2),<br>                              blurRadius: 10,<br>                              offset: const Offset(0, 5),<br>                            ),<br>                          ],<br>                        ),<br>                        child: ClipRRect(<br>                          borderRadius: BorderRadius.circular(20),<br>                          child: Stack(<br>                            children: [<br>                              CachedNetworkImage(<br>                                imageUrl: url,<br>                                fit: BoxFit.cover,<br>                                width: double.infinity,<br>                                height: double.infinity,<br>                                placeholder: (context, url) =&gt;<br>                                const Center(child: CircularProgressIndicator(strokeWidth: 2)),<br>                                errorWidget: (context, url, error) =&gt;<br>                                const Center(child: Icon(Icons.error)),<br>                              ),<br>                              Container(<br>                                decoration: BoxDecoration(<br>                                  gradient: LinearGradient(<br>                                    begin: Alignment.topCenter,<br>                                    end: Alignment.bottomCenter,<br>                                    colors: [<br>                                      Colors.transparent,<br>                                      Colors.black.withOpacity(0.7),<br>                                    ],<br>                                  ),<br>                                ),<br>                              ),<br>                              Positioned(<br>                                bottom: 15,<br>                                left: 15,<br>                                child: Column(<br>                                  crossAxisAlignment: CrossAxisAlignment.start,<br>                                  children: [<br>                                    Container(<br>                                      padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),<br>                                      decoration: BoxDecoration(<br>                                        color: Colors.blue[700],<br>                                        borderRadius: BorderRadius.circular(4),<br>                                      ),<br>                                      child: const Text(<br>                                        &quot;FEATURED&quot;,<br>                                        style: TextStyle(<br>                                          color: Colors.white,<br>                                          fontSize: 10,<br>                                          fontWeight: FontWeight.bold,<br>                                        ),<br>                                      ),<br>                                    ),<br>                                    const SizedBox(height: 6),<br>                                    const Text(<br>                                      &quot;Premium Cars Collection&quot;,<br>                                      style: TextStyle(<br>                                        color: Colors.white,<br>                                        fontSize: 16,<br>                                        fontWeight: FontWeight.bold,<br>                                      ),<br>                                    ),<br>                                  ],<br>                                ),<br>                              ),<br>                            ],<br>                          ),<br>                        ),<br>                      );<br>                    },<br>                  );<br>                }).toList(),<br>              ),<br>            ],<br><br>            // Display &quot;Search Results&quot; title when searching<br>            if (_searchQuery.isNotEmpty)<br>              Padding(<br>                padding: const EdgeInsets.all(16),<br>                child: Row(<br>                  children: [<br>                    Text(<br>                      &quot;Search Results&quot;,<br>                      style: TextStyle(<br>                        fontSize: 16,<br>                        fontWeight: FontWeight.bold,<br>                      ),<br>                    ),<br>                    SizedBox(width: 8),<br>                    Container(<br>                      padding: EdgeInsets.symmetric(horizontal: 8, vertical: 2),<br>                      decoration: BoxDecoration(<br>                        color: Colors.blue[700],<br>                        borderRadius: BorderRadius.circular(12),<br>                      ),<br>                      child: Text(<br>                        &quot;\&quot;$_searchQuery\&quot;&quot;,<br>                        style: TextStyle(<br>                          color: Colors.white,<br>                          fontSize: 12,<br>                          fontWeight: FontWeight.w500,<br>                        ),<br>                      ),<br>                    ),<br>                  ],<br>                ),<br>              ),<br><br>            // Display &quot;Available Cars&quot; title when not searching<br>            if (_searchQuery.isEmpty)<br>              Padding(<br>                padding: const EdgeInsets.all(16),<br>                child: Row(<br>                  mainAxisAlignment: MainAxisAlignment.spaceBetween,<br>                  children: [<br>                    const Text(<br>                      &quot;Available Cars&quot;,<br>                      style: TextStyle(<br>                        fontSize: 16,<br>                        fontWeight: FontWeight.bold,<br>                      ),<br>                    ),<br>                    TextButton(<br>                      onPressed: () {},<br>                      child: Text(<br>                        &quot;View All&quot;,<br>                        style: TextStyle(<br>                          color: Colors.blue[700],<br>                          fontWeight: FontWeight.w600,<br>                        ),<br>                      ),<br>                    ),<br>                  ],<br>                ),<br>              ),<br><br>            // Car Grid with search functionality<br>            StreamBuilder&lt;QuerySnapshot&gt;(<br>              stream: FirebaseFirestore.instance.collection(&#39;cars&#39;).snapshots(),<br>              builder: (context, snapshot) {<br>                if (!snapshot.hasData) {<br>                  return const Center(<br>                    child: Padding(<br>                      padding: EdgeInsets.all(20),<br>                      child: CircularProgressIndicator(),<br>                    ),<br>                  );<br>                }<br><br>                final allCars = snapshot.data!.docs;<br>                final List&lt;QueryDocumentSnapshot&gt; filteredCars;<br><br>                // Apply search filter<br>                if (_searchQuery.isNotEmpty) {<br>                  final query = _searchQuery.toLowerCase();<br>                  filteredCars = allCars.where((doc) {<br>                    final carData = doc.data() as Map&lt;String, dynamic&gt;;<br>                    final carName = (carData[&#39;name&#39;] ?? &#39;&#39;).toString().toLowerCase();<br>                    final carBrand = (carData[&#39;brand&#39;] ?? &#39;&#39;).toString().toLowerCase();<br>                    final carModel = (carData[&#39;model&#39;] ?? &#39;&#39;).toString().toLowerCase();<br>                    final carFuel = (carData[&#39;fuel&#39;] ?? &#39;&#39;).toString().toLowerCase();<br><br>                    return carName.contains(query) ||<br>                        carBrand.contains(query) ||<br>                        carModel.contains(query) ||<br>                        carFuel.contains(query);<br>                  }).toList();<br>                } else {<br>                  filteredCars = allCars;<br>                }<br><br>                // Show &quot;No cars found&quot; message if filtered list is empty<br>                if (filteredCars.isEmpty &amp;&amp; _searchQuery.isNotEmpty) {<br>                  return Center(<br>                    child: Padding(<br>                      padding: const EdgeInsets.symmetric(vertical: 60),<br>                      child: Column(<br>                        children: [<br>                          Icon(<br>                            Icons.car_crash_outlined,<br>                            size: 70,<br>                            color: Colors.grey[400],<br>                          ),<br>                          const SizedBox(height: 16),<br>                          Text(<br>                            &quot;No Cars Found&quot;,<br>                            style: TextStyle(<br>                              fontSize: 18,<br>                              fontWeight: FontWeight.bold,<br>                              color: Colors.grey[700],<br>                            ),<br>                          ),<br>                          const SizedBox(height: 8),<br>                          Text(<br>                            &quot;We couldn&#39;t find any cars matching your search&quot;,<br>                            style: TextStyle(<br>                              fontSize: 14,<br>                              color: Colors.grey[600],<br>                            ),<br>                          ),<br>                          const SizedBox(height: 20),<br>                          ElevatedButton.icon(<br>                            onPressed: () {<br>                              setState(() {<br>                                _searchController.clear();<br>                                _searchQuery = &quot;&quot;;<br>                              });<br>                            },<br>                            icon: Icon(Icons.refresh),<br>                            label: Text(&quot;Clear Search&quot;),<br>                            style: ElevatedButton.styleFrom(<br>                              backgroundColor: Colors.blue[700],<br>                              foregroundColor: Colors.white,<br>                              padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),<br>                              shape: RoundedRectangleBorder(<br>                                borderRadius: BorderRadius.circular(12),<br>                              ),<br>                            ),<br>                          ),<br>                        ],<br>                      ),<br>                    ),<br>                  );<br>                }<br><br>                // Show car grid when we have results<br>                return Padding(<br>                  padding: const EdgeInsets.symmetric(horizontal: 16),<br>                  child: GridView.builder(<br>                    shrinkWrap: true,<br>                    physics: const NeverScrollableScrollPhysics(),<br>                    gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(<br>                      crossAxisCount: 2,<br>                      childAspectRatio: 0.55,<br>                      crossAxisSpacing: 15,<br>                      mainAxisSpacing: 15,<br>                    ),<br>                    itemCount: filteredCars.length,<br>                    itemBuilder: (context, index) {<br>                      final car = filteredCars[index].data() as Map&lt;String, dynamic&gt;;<br>                      return PremiumCarCard(carData: car);<br>                    },<br>                  ),<br>                );<br>              },<br>            ),<br><br>            const SizedBox(height: 20),<br>            CarFooter()<br><br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}<br><br>// File 2: CarFooter.dart - This should be in a separate file<br><br>class CarFooter extends StatefulWidget {<br>  const CarFooter({Key? key}) : super(key: key);<br><br>  @override<br>  State&lt;CarFooter&gt; createState() =&gt; _CarFooterState();<br>}<br><br>class _CarFooterState extends State&lt;CarFooter&gt; {<br>  final TextEditingController _emailController = TextEditingController();<br><br>  @override<br>  void dispose() {<br>    _emailController.dispose();<br>    super.dispose();<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    // Using MediaQuery to make layout responsive<br>    final screenWidth = MediaQuery.of(context).size.width;<br>    final isMobile = screenWidth &lt; 600;<br><br>    return Container(<br>      color: Colors.black,<br>      padding: const EdgeInsets.symmetric(vertical: 30, horizontal: 20),<br>      child: Column(<br>        children: [<br>          // Main Footer Content - Responsive layout<br>          isMobile<br>              ? _buildMobileLayout()<br>              : _buildDesktopLayout(),<br><br>          const SizedBox(height: 30),<br><br>          // Copyright Section<br>          Container(<br>            padding: const EdgeInsets.only(top: 20),<br>            decoration: BoxDecoration(<br>              border: Border(<br>                top: BorderSide(color: Colors.white.withOpacity(0.1), width: 1),<br>              ),<br>            ),<br>            child: const Center(<br>              child: Text(<br>                &#39;© Copyright 2024 Car4deal All Right Reserved.&#39;,<br>                style: TextStyle(color: Colors.white60, fontSize: 12),<br>              ),<br>            ),<br>          ),<br>        ],<br>      ),<br>    );<br>  }<br><br>  Widget _buildMobileLayout() {<br>    return Column(<br>      crossAxisAlignment: CrossAxisAlignment.start,<br>      children: [<br>        // Logo and Contact Info Section<br>        Column(<br>          crossAxisAlignment: CrossAxisAlignment.start,<br>          children: [<br>            // Logo<br>            Image.asset(<br>              &#39;assets/images/carfodeal.png&#39;,<br>              height: 50,<br>              color: Colors.white,<br>            ),<br>            const SizedBox(height: 15),<br><br>            // Address<br>            Row(<br>              crossAxisAlignment: CrossAxisAlignment.start,<br>              children: [<br>                const Icon(Icons.location_on, color: Colors.white54, size: 18),<br>                const SizedBox(width: 8),<br>                Expanded(<br>                  child: Text(<br>                    &#39;118/3Lower, ground floor, Safdarjung Enclave, Delhi - 110029&#39;,<br>                    style: const TextStyle(color: Colors.white70, fontSize: 13),<br>                  ),<br>                ),<br>              ],<br>            ),<br>            const SizedBox(height: 10),<br><br>            // Phone<br>            Row(<br>              children: [<br>                const Icon(Icons.phone, color: Colors.white54, size: 18),<br>                const SizedBox(width: 8),<br>                const Text(<br>                  &#39;+91 9205268499&#39;,<br>                  style: TextStyle(color: Colors.white70, fontSize: 13),<br>                ),<br>              ],<br>            ),<br>            const SizedBox(height: 10),<br><br>            // Email<br>            Row(<br>              children: [<br>                const Icon(Icons.email, color: Colors.white54, size: 18),<br>                const SizedBox(width: 8),<br>                const Text(<br>                  &#39;empireautogroupz@gmail.com&#39;,<br>                  style: TextStyle(color: Colors.white70, fontSize: 13),<br>                ),<br>              ],<br>            ),<br>          ],<br>        ),<br>        const SizedBox(height: 30),<br><br>        // Information Section<br>        Column(<br>          crossAxisAlignment: CrossAxisAlignment.start,<br>          children: [<br>            const Text(<br>              &#39;Information&#39;,<br>              style: TextStyle(<br>                color: Colors.white,<br>                fontSize: 16,<br>                fontWeight: FontWeight.bold,<br>              ),<br>            ),<br>            const SizedBox(height: 15),<br>            Wrap(<br>              spacing: 20,<br>              runSpacing: 8,<br>              children: [<br>                _buildFooterLink(&#39;Custom Requirement&#39;),<br>                _buildFooterLink(&#39;EMI Calculator&#39;),<br>                _buildFooterLink(&#39;Insurance&#39;),<br>                _buildFooterLink(&#39;Contact Us&#39;),<br>                _buildFooterLink(&#39;About Us&#39;),<br>                _buildFooterLink(&#39;Privacy Policy&#39;),<br>                _buildFooterLink(&#39;Terms &amp; Conditions&#39;),<br>                _buildFooterLink(&#39;Refund Policy&#39;),<br>                _buildFooterLink(&#39;Return Policy&#39;),<br>                _buildFooterLink(&#39;Delivery Policy&#39;),<br>              ],<br>            ),<br>          ],<br>        ),<br>        const SizedBox(height: 30),<br><br>        // Brands Section<br>        Column(<br>          crossAxisAlignment: CrossAxisAlignment.start,<br>          children: [<br>            const Text(<br>              &#39;Brands&#39;,<br>              style: TextStyle(<br>                color: Colors.white,<br>                fontSize: 16,<br>                fontWeight: FontWeight.bold,<br>              ),<br>            ),<br>            const SizedBox(height: 15),<br>            Wrap(<br>              spacing: 20,<br>              runSpacing: 8,<br>              children: [<br>                _buildFooterLink(&#39;Toyota&#39;),<br>                _buildFooterLink(&#39;Honda&#39;),<br>                _buildFooterLink(&#39;Ford&#39;),<br>                _buildFooterLink(&#39;BMW&#39;),<br>                _buildFooterLink(&#39;Mercedes&#39;),<br>                _buildFooterLink(&#39;Audi&#39;),<br>                _buildFooterLink(&#39;Volkswagen&#39;),<br>                _buildFooterLink(&#39;Aston Martin&#39;),<br>                _buildFooterLink(&#39;Hummer&#39;),<br>                _buildFooterLink(&#39;Jaguar&#39;),<br>                _buildFooterLink(&#39;Jeep&#39;),<br>                _buildFooterLink(&#39;Volvo&#39;),<br>                _buildFooterLink(&#39;Maruti Suzuki&#39;),<br>                _buildFooterLink(&#39;Bentley&#39;),<br>                _buildFooterLink(&#39;Ferrari&#39;),<br>                _buildFooterLink(&#39;Fiat&#39;),<br>                _buildFooterLink(&#39;KIA&#39;),<br>                _buildFooterLink(&#39;Chrysler&#39;),<br>                _buildFooterLink(&#39;Lamborghini&#39;),<br>                _buildFooterLink(&#39;Land Rover&#39;),<br>                _buildFooterLink(&#39;Lexus&#39;),<br>                _buildFooterLink(&#39;Range Rover&#39;),<br>              ],<br>            ),<br>          ],<br>        ),<br>        const SizedBox(height: 30),<br><br>        // Search by Category Section<br>        Column(<br>          crossAxisAlignment: CrossAxisAlignment.start,<br>          children: [<br>            const Text(<br>              &#39;Search by category&#39;,<br>              style: TextStyle(<br>                color: Colors.white,<br>                fontSize: 16,<br>                fontWeight: FontWeight.bold,<br>              ),<br>            ),<br>            const SizedBox(height: 15),<br>            _buildFooterLink(&#39;Search by City&#39;),<br>            _buildFooterLink(&#39;Search by Year&#39;),<br>            _buildFooterLink(&#39;Search by Color&#39;),<br>            _buildFooterLink(&#39;Search by Price&#39;),<br>          ],<br>        ),<br>        const SizedBox(height: 30),<br><br>        // Newsletter Section<br>        Column(<br>          crossAxisAlignment: CrossAxisAlignment.start,<br>          children: [<br>            const Text(<br>              &#39;Newsletter&#39;,<br>              style: TextStyle(<br>                color: Colors.white,<br>                fontSize: 16,<br>                fontWeight: FontWeight.bold,<br>              ),<br>            ),<br>            const SizedBox(height: 15),<br>            const Text(<br>              &#39;Keep up on our always evolving vehicle features and technology. Enter your e-mail and subscribe to our newsletter.&#39;,<br>              style: TextStyle(color: Colors.white70, fontSize: 13),<br>            ),<br>            const SizedBox(height: 15),<br>            Row(<br>              children: [<br>                Expanded(<br>                  child: Container(<br>                    height: 45,<br>                    decoration: BoxDecoration(<br>                      color: Colors.white,<br>                      borderRadius: BorderRadius.circular(4),<br>                    ),<br>                    child: TextField(<br>                      controller: _emailController,<br>                      decoration: const InputDecoration(<br>                        hintText: &#39;Email&#39;,<br>                        border: InputBorder.none,<br>                        contentPadding: EdgeInsets.symmetric(horizontal: 15),<br>                      ),<br>                      style: const TextStyle(fontSize: 14),<br>                    ),<br>                  ),<br>                ),<br>                Container(<br>                  height: 45,<br>                  width: 45,<br>                  decoration: BoxDecoration(<br>                    color: Colors.blue[700],<br>                    borderRadius: BorderRadius.circular(4),<br>                  ),<br>                  child: IconButton(<br>                    icon: const Icon(Icons.send, color: Colors.white),<br>                    onPressed: _handleSubscription,<br>                  ),<br>                ),<br>              ],<br>            ),<br>          ],<br>        ),<br>      ],<br>    );<br>  }<br><br>  Widget _buildDesktopLayout() {<br>    return Row(<br>      crossAxisAlignment: CrossAxisAlignment.start,<br>      children: [<br>        // Logo and Contact Info Section<br>        Expanded(<br>          flex: 3,<br>          child: Column(<br>            crossAxisAlignment: CrossAxisAlignment.start,<br>            children: [<br>              // Logo<br>              Image.asset(<br>                &#39;assets/images/carfodeal.png&#39;,<br>                height: 50,<br>                color: Colors.white,<br>              ),<br>              const SizedBox(height: 15),<br><br>              // Address<br>              Row(<br>                crossAxisAlignment: CrossAxisAlignment.start,<br>                children: [<br>                  const Icon(Icons.location_on, color: Colors.white54, size: 18),<br>                  const SizedBox(width: 8),<br>                  Expanded(<br>                    child: Text(<br>                      &#39;118/3Lower, ground floor, Safdarjung Enclave, Delhi - 110029&#39;,<br>                      style: const TextStyle(color: Colors.white70, fontSize: 13),<br>                    ),<br>                  ),<br>                ],<br>              ),<br>              const SizedBox(height: 10),<br><br>              // Phone<br>              Row(<br>                children: [<br>                  const Icon(Icons.phone, color: Colors.white54, size: 18),<br>                  const SizedBox(width: 8),<br>                  const Text(<br>                    &#39;+91 9205268499&#39;,<br>                    style: TextStyle(color: Colors.white70, fontSize: 13),<br>                  ),<br>                ],<br>              ),<br>              const SizedBox(height: 10),<br><br>              // Email<br>              Row(<br>                children: [<br>                  const Icon(Icons.email, color: Colors.white54, size: 18),<br>                  const SizedBox(width: 8),<br>                  const Text(<br>                    &#39;empireautogroupz@gmail.com&#39;,<br>                    style: TextStyle(color: Colors.white70, fontSize: 13),<br>                  ),<br>                ],<br>              ),<br>            ],<br>          ),<br>        ),<br><br>        // Information Section<br>        Expanded(<br>          flex: 2,<br>          child: Column(<br>            crossAxisAlignment: CrossAxisAlignment.start,<br>            children: [<br>              const Text(<br>                &#39;Information&#39;,<br>                style: TextStyle(<br>                  color: Colors.white,<br>                  fontSize: 16,<br>                  fontWeight: FontWeight.bold,<br>                ),<br>              ),<br>              const SizedBox(height: 15),<br>              _buildFooterLink(&#39;Custom Requirement&#39;),<br>              _buildFooterLink(&#39;EMI Calculator&#39;),<br>              _buildFooterLink(&#39;Insurance&#39;),<br>              _buildFooterLink(&#39;Contact Us&#39;),<br>              _buildFooterLink(&#39;About Us&#39;),<br>              _buildFooterLink(&#39;Privacy Policy&#39;),<br>              _buildFooterLink(&#39;Terms &amp; Conditions&#39;),<br>              _buildFooterLink(&#39;Refund Policy&#39;),<br>              _buildFooterLink(&#39;Return Policy&#39;),<br>              _buildFooterLink(&#39;Delivery Policy&#39;),<br>            ],<br>          ),<br>        ),<br><br>        // Brands Section<br>        Expanded(<br>          flex: 2,<br>          child: Column(<br>            crossAxisAlignment: CrossAxisAlignment.start,<br>            children: [<br>              const Text(<br>                &#39;Brands&#39;,<br>                style: TextStyle(<br>                  color: Colors.white,<br>                  fontSize: 16,<br>                  fontWeight: FontWeight.bold,<br>                ),<br>              ),<br>              const SizedBox(height: 15),<br>              Row(<br>                children: [<br>                  Expanded(<br>                    child: Column(<br>                      crossAxisAlignment: CrossAxisAlignment.start,<br>                      children: [<br>                        _buildFooterLink(&#39;Toyota&#39;),<br>                        _buildFooterLink(&#39;Honda&#39;),<br>                        _buildFooterLink(&#39;Ford&#39;),<br>                        _buildFooterLink(&#39;BMW&#39;),<br>                        _buildFooterLink(&#39;Mercedes&#39;),<br>                        _buildFooterLink(&#39;Audi&#39;),<br>                        _buildFooterLink(&#39;Volkswagen&#39;),<br>                        _buildFooterLink(&#39;Aston Martin&#39;),<br>                        _buildFooterLink(&#39;Hummer&#39;),<br>                        _buildFooterLink(&#39;Jaguar&#39;),<br>                        _buildFooterLink(&#39;Jeep&#39;),<br>                      ],<br>                    ),<br>                  ),<br>                  Expanded(<br>                    child: Column(<br>                      crossAxisAlignment: CrossAxisAlignment.start,<br>                      children: [<br>                        _buildFooterLink(&#39;Volvo&#39;),<br>                        _buildFooterLink(&#39;Maruti Suzuki&#39;),<br>                        _buildFooterLink(&#39;Bentley&#39;),<br>                        _buildFooterLink(&#39;Ferrari&#39;),<br>                        _buildFooterLink(&#39;Fiat&#39;),<br>                        _buildFooterLink(&#39;KIA&#39;),<br>                        _buildFooterLink(&#39;Chrysler&#39;),<br>                        _buildFooterLink(&#39;Lamborghini&#39;),<br>                        _buildFooterLink(&#39;Land Rover&#39;),<br>                        _buildFooterLink(&#39;Lexus&#39;),<br>                        _buildFooterLink(&#39;Range Rover&#39;),<br>                      ],<br>                    ),<br>                  ),<br>                ],<br>              ),<br>            ],<br>          ),<br>        ),<br><br>        // Search by Category Section<br>        Expanded(<br>          flex: 2,<br>          child: Column(<br>            crossAxisAlignment: CrossAxisAlignment.start,<br>            children: [<br>              const Text(<br>                &#39;Search by category&#39;,<br>                style: TextStyle(<br>                  color: Colors.white,<br>                  fontSize: 16,<br>                  fontWeight: FontWeight.bold,<br>                ),<br>              ),<br>              const SizedBox(height: 15),<br>              _buildFooterLink(&#39;Search by City&#39;),<br>              _buildFooterLink(&#39;Search by Year&#39;),<br>              _buildFooterLink(&#39;Search by Color&#39;),<br>              _buildFooterLink(&#39;Search by Price&#39;),<br>            ],<br>          ),<br>        ),<br><br>        // Newsletter Section<br>        Expanded(<br>          flex: 3,<br>          child: Column(<br>            crossAxisAlignment: CrossAxisAlignment.start,<br>            children: [<br>              const Text(<br>                &#39;Newsletter&#39;,<br>                style: TextStyle(<br>                  color: Colors.white,<br>                  fontSize: 16,<br>                  fontWeight: FontWeight.bold,<br>                ),<br>              ),<br>              const SizedBox(height: 15),<br>              const Text(<br>                &#39;Keep up on our always evolving vehicle features and technology. Enter your e-mail and subscribe to our newsletter.&#39;,<br>                style: TextStyle(color: Colors.white70, fontSize: 13),<br>              ),<br>              const SizedBox(height: 15),<br>              Row(<br>                children: [<br>                  Expanded(<br>                    child: Container(<br>                      height: 45,<br>                      decoration: BoxDecoration(<br>                        color: Colors.white,<br>                        borderRadius: BorderRadius.circular(4),<br>                      ),<br>                      child: TextField(<br>                        controller: _emailController,<br>                        decoration: const InputDecoration(<br>                          hintText: &#39;Email&#39;,<br>                          border: InputBorder.none,<br>                          contentPadding: EdgeInsets.symmetric(horizontal: 15),<br>                        ),<br>                        style: const TextStyle(fontSize: 14),<br>                      ),<br>                    ),<br>                  ),<br>                  Container(<br>                    height: 45,<br>                    width: 45,<br>                    decoration: BoxDecoration(<br>                      color: Colors.blue[700],<br>                      borderRadius: BorderRadius.circular(4),<br>                    ),<br>                    child: IconButton(<br>                      icon: const Icon(Icons.send, color: Colors.white),<br>                      onPressed: _handleSubscription,<br>                    ),<br>                  ),<br>                ],<br>              ),<br>            ],<br>          ),<br>        ),<br>      ],<br>    );<br>  }<br><br>  void _handleSubscription() {<br>    // Handle newsletter subscription<br>    if (_emailController.text.isNotEmpty) {<br>      // Add your subscription logic here<br>      ScaffoldMessenger.of(context).showSnackBar(<br>        const SnackBar(<br>          content: Text(&#39;Thank you for subscribing!&#39;),<br>          backgroundColor: Colors.green,<br>        ),<br>      );<br>      _emailController.clear();<br>    }<br>  }<br><br>  Widget _buildFooterLink(String text) {<br>    return Padding(<br>      padding: const EdgeInsets.only(bottom: 8),<br>      child: GestureDetector(<br>        onTap: () {<br>          // Handle link tap<br>          // Navigate to corresponding page<br>        },<br>        child: Text(<br>          text,<br>          style: const TextStyle(color: Colors.white70, fontSize: 13),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ee15bd7f275" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Car homepage]]></title>
            <link>https://sandeepkumaredugaon.medium.com/car-homepage-4b3e35c95d9c?source=rss-0fc1a07cda66------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b3e35c95d9c</guid>
            <dc:creator><![CDATA[Sandeep Kumar]]></dc:creator>
            <pubDate>Thu, 15 May 2025 10:08:33 GMT</pubDate>
            <atom:updated>2025-05-15T10:08:33.578Z</atom:updated>
            <content:encoded><![CDATA[<pre>// import &#39;package:flutter/material.dart&#39;;<br>// import &#39;package:carousel_slider/carousel_slider.dart&#39;;<br>// import &#39;package:font_awesome_flutter/font_awesome_flutter.dart&#39;;<br>//<br>// import &#39;../EmailAuth/drawer.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>//   final List&lt;String&gt; imagePaths = [<br>//     &#39;assets/images/img1.jpg&#39;,<br>//     &#39;assets/images/img2.jpg&#39;,<br>//     &#39;assets/images/img3.jpg&#39;,<br>//     &#39;assets/images/img4.jpg&#39;,<br>//     &#39;assets/images/img5.jpg&#39;,<br>//   ];<br>//<br>//   @override<br>//   Widget build(BuildContext context) {<br>//     return Scaffold(<br>//       appBar: AppBar(<br>//         actions: [<br>//           const Padding(<br>//             padding: EdgeInsets.only(right: 30),<br>//             child: Text(<br>//               &quot;Login&quot;,<br>//               style: TextStyle(<br>//                   color: Colors.black, fontWeight: FontWeight.bold, fontSize: 18),<br>//             ),<br>//           ),<br>//<br>//         ],<br>//         title: SizedBox(<br>//           child: Image.asset(<br>//             &#39;assets/images/carfodeal.png&#39;,<br>//             height: 40,<br>//           ),<br>//         ),<br>//       ),<br>//       drawer: const CustomDrawer(), // Use the custom drawer here<br>//       body: SingleChildScrollView(<br>//         child: Column(<br>//           children: [<br>//             const SizedBox(height: 20),<br>//<br>//             // Carousel Slider<br>//             CarouselSlider(<br>//               options: CarouselOptions(<br>//                 height: 170,<br>//                 autoPlay: true,<br>//                 enlargeCenterPage: true,<br>//                 aspectRatio: 16 / 8,<br>//                 autoPlayInterval: const Duration(seconds: 3),<br>//               ),<br>//               items: [<br>//                 &#39;https://car4deal.com/assets/img/cars/wwwww.webp&#39;,<br>//                 &#39;https://car4deal.com/admin/uploads/product/fortuner%2001dmghfjf.png&#39;,<br>//                 &#39;https://car4deal.com/assets/img/cars/5-car4deal.webp&#39;,<br>//                 &#39;https://car4deal.com/assets/img/cars/ssd-1.png&#39;,<br>//                 &#39;https://car4deal.com/assets/img/cars/ff-2.webp&#39;,<br>//               ].map((url) {<br>//                 return Builder(<br>//                   builder: (BuildContext context) {<br>//                     return ClipRRect(<br>//                       borderRadius: BorderRadius.circular(15),<br>//                       child: Image.network(<br>//                         url,<br>//                         fit: BoxFit.cover,<br>//                         width: double.infinity,<br>//                         loadingBuilder: (context, child, progress) {<br>//                           return progress == null<br>//                               ? child<br>//                               : Center(child: CircularProgressIndicator());<br>//                         },<br>//                         errorBuilder: (context, error, stackTrace) =&gt;<br>//                         const Center(child: Icon(Icons.error)),<br>//                       ),<br>//                     );<br>//                   },<br>//                 );<br>//               }).toList(),<br>//             ),<br>//<br>//           ],<br>//         ),<br>//       ),<br>//     );<br>//   }<br>// }<br>import &#39;dart:io&#39;;<br>import &#39;package:cloud_firestore/cloud_firestore.dart&#39;;<br>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:carousel_slider/carousel_slider.dart&#39;;<br>import &#39;package:cached_network_image/cached_network_image.dart&#39;;<br>import &#39;package:url_launcher/url_launcher.dart&#39;;<br><br><br>import &#39;../EmailAuth/drawer.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>  final List&lt;String&gt; imageUrls = [<br>    &#39;https://car4deal.com/assets/img/cars/wwwww.webp&#39;,<br>    &#39;https://car4deal.com/admin/uploads/product/fortuner%2001dmghfjf.png&#39;,<br>    &#39;https://car4deal.com/assets/img/cars/5-car4deal.webp&#39;,<br>    &#39;https://car4deal.com/assets/img/cars/ssd-1.png&#39;,<br>    &#39;https://car4deal.com/assets/img/cars/ff-2.webp&#39;,<br>  ];<br><br>  final List&lt;Map&lt;String, dynamic&gt;&gt; categories = [<br>    {&#39;icon&#39;: Icons.directions_car, &#39;name&#39;: &#39;Sedan&#39;},<br>    {&#39;icon&#39;: Icons.airport_shuttle, &#39;name&#39;: &#39;SUV&#39;},<br>    {&#39;icon&#39;: Icons.sports_motorsports, &#39;name&#39;: &#39;Sports&#39;},<br>    {&#39;icon&#39;: Icons.electric_car, &#39;name&#39;: &#39;Electric&#39;},<br>    {&#39;icon&#39;: Icons.family_restroom, &#39;name&#39;: &#39;Family&#39;},<br>  ];<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      backgroundColor: Colors.grey[100],<br>      appBar: AppBar(<br>        elevation: 0,<br>        backgroundColor: Colors.white,<br>        actions: [<br>          Container(<br>            margin: const EdgeInsets.only(right: 15),<br>            padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),<br>            decoration: BoxDecoration(<br>              color: Colors.blue[700],<br>              borderRadius: BorderRadius.circular(20),<br>            ),<br>            child: const Text(<br>              &quot;Login&quot;,<br>              style: TextStyle(<br>                color: Colors.white,<br>                fontWeight: FontWeight.bold,<br>                fontSize: 14,<br>              ),<br>            ),<br>          ),<br>        ],<br>        title: SizedBox(<br>          child: Image.asset(<br>            &#39;assets/images/carfodeal.png&#39;,<br>            height: 35,<br>          ),<br>        ),<br>      ),<br>      drawer: const CustomDrawer(),<br>      body: SingleChildScrollView(<br>        child: Column(<br>          crossAxisAlignment: CrossAxisAlignment.start,<br>          children: [<br>            // Hero Section with Search<br>            Container(<br>              padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),<br>              decoration: BoxDecoration(<br>                color: Colors.white,<br>                boxShadow: [<br>                  BoxShadow(<br>                    color: Colors.black.withOpacity(0.05),<br>                    blurRadius: 10,<br>                    offset: const Offset(0, 5),<br>                  ),<br>                ],<br>              ),<br>              child: Column(<br>                crossAxisAlignment: CrossAxisAlignment.start,<br>                children: [<br>                  const Text(<br>                    &quot;Find Your Dream Car&quot;,<br>                    style: TextStyle(<br>                      fontSize: 20,<br>                      fontWeight: FontWeight.bold,<br>                    ),<br>                  ),<br>                  const SizedBox(height: 5),<br>                  Text(<br>                    &quot;Browse through our premium collection&quot;,<br>                    style: TextStyle(<br>                      fontSize: 13,<br>                      color: Colors.grey,<br>                    ),<br>                  ),<br>                  const SizedBox(height: 15),<br>                  Container(<br>                    padding: const EdgeInsets.symmetric(horizontal: 15),<br>                    decoration: BoxDecoration(<br>                      color: Colors.grey[200],<br>                      borderRadius: BorderRadius.circular(12),<br>                    ),<br>                    child: const TextField(<br>                      decoration: InputDecoration(<br>                        border: InputBorder.none,<br>                        hintText: &quot;Search cars, brands...&quot;,<br>                        hintStyle: TextStyle(color: Colors.grey),<br>                        icon: Icon(Icons.search, color: Colors.grey),<br>                      ),<br>                    ),<br>                  ),<br>                ],<br>              ),<br>            ),<br><br>            // Categories<br>            Padding(<br>              padding: const EdgeInsets.all(16),<br>              child: Column(<br>                crossAxisAlignment: CrossAxisAlignment.start,<br>                children: [<br>                  const Text(<br>                    &quot;Categories&quot;,<br>                    style: TextStyle(<br>                      fontSize: 16,<br>                      fontWeight: FontWeight.bold,<br>                    ),<br>                  ),<br>                  const SizedBox(height: 12),<br>                  SizedBox(<br>                    height: 90,<br>                    child: ListView.builder(<br>                      scrollDirection: Axis.horizontal,<br>                      itemCount: categories.length,<br>                      itemBuilder: (context, index) {<br>                        return Container(<br>                          width: 80,<br>                          margin: const EdgeInsets.only(right: 12),<br>                          child: Column(<br>                            children: [<br>                              Container(<br>                                height: 50,<br>                                width: 50,<br>                                decoration: BoxDecoration(<br>                                  color: Colors.blue[700],<br>                                  borderRadius: BorderRadius.circular(25),<br>                                ),<br>                                child: Icon(<br>                                  categories[index][&#39;icon&#39;],<br>                                  color: Colors.white,<br>                                ),<br>                              ),<br>                              const SizedBox(height: 8),<br>                              Text(<br>                                categories[index][&#39;name&#39;],<br>                                style: const TextStyle(<br>                                  fontSize: 12,<br>                                  fontWeight: FontWeight.w500,<br>                                ),<br>                              ),<br>                            ],<br>                          ),<br>                        );<br>                      },<br>                    ),<br>                  ),<br>                ],<br>              ),<br>            ),<br><br>            // Featured Cars Slider<br>            Padding(<br>              padding: const EdgeInsets.symmetric(horizontal: 16),<br>              child: const Text(<br>                &quot;Featured Cars&quot;,<br>                style: TextStyle(<br>                  fontSize: 16,<br>                  fontWeight: FontWeight.bold,<br>                ),<br>              ),<br>            ),<br>            const SizedBox(height: 12),<br><br>            CarouselSlider(<br>              options: CarouselOptions(<br>                height: 180,<br>                autoPlay: true,<br>                enlargeCenterPage: true,<br>                viewportFraction: 0.85,<br>                aspectRatio: 16 / 9,<br>                autoPlayInterval: const Duration(seconds: 3),<br>              ),<br>              items: imageUrls.map((url) {<br>                return Builder(<br>                  builder: (BuildContext context) {<br>                    return Container(<br>                      width: MediaQuery.of(context).size.width,<br>                      margin: const EdgeInsets.symmetric(horizontal: 5),<br>                      decoration: BoxDecoration(<br>                        borderRadius: BorderRadius.circular(20),<br>                        boxShadow: [<br>                          BoxShadow(<br>                            color: Colors.black.withOpacity(0.2),<br>                            blurRadius: 10,<br>                            offset: const Offset(0, 5),<br>                          ),<br>                        ],<br>                      ),<br>                      child: ClipRRect(<br>                        borderRadius: BorderRadius.circular(20),<br>                        child: Stack(<br>                          children: [<br>                            CachedNetworkImage(<br>                              imageUrl: url,<br>                              fit: BoxFit.cover,<br>                              width: double.infinity,<br>                              height: double.infinity,<br>                              placeholder: (context, url) =&gt;<br>                              const Center(child: CircularProgressIndicator(strokeWidth: 2)),<br>                              errorWidget: (context, url, error) =&gt;<br>                              const Center(child: Icon(Icons.error)),<br>                            ),<br>                            Container(<br>                              decoration: BoxDecoration(<br>                                gradient: LinearGradient(<br>                                  begin: Alignment.topCenter,<br>                                  end: Alignment.bottomCenter,<br>                                  colors: [<br>                                    Colors.transparent,<br>                                    Colors.black.withOpacity(0.7),<br>                                  ],<br>                                ),<br>                              ),<br>                            ),<br>                            Positioned(<br>                              bottom: 15,<br>                              left: 15,<br>                              child: Column(<br>                                crossAxisAlignment: CrossAxisAlignment.start,<br>                                children: [<br>                                  Container(<br>                                    padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),<br>                                    decoration: BoxDecoration(<br>                                      color: Colors.blue[700],<br>                                      borderRadius: BorderRadius.circular(4),<br>                                    ),<br>                                    child: const Text(<br>                                      &quot;FEATURED&quot;,<br>                                      style: TextStyle(<br>                                        color: Colors.white,<br>                                        fontSize: 10,<br>                                        fontWeight: FontWeight.bold,<br>                                      ),<br>                                    ),<br>                                  ),<br>                                  const SizedBox(height: 6),<br>                                  const Text(<br>                                    &quot;Premium Cars Collection&quot;,<br>                                    style: TextStyle(<br>                                      color: Colors.white,<br>                                      fontSize: 16,<br>                                      fontWeight: FontWeight.bold,<br>                                    ),<br>                                  ),<br>                                ],<br>                              ),<br>                            ),<br>                          ],<br>                        ),<br>                      ),<br>                    );<br>                  },<br>                );<br>              }).toList(),<br>            ),<br><br>            // Available Cars Title<br>            Padding(<br>              padding: const EdgeInsets.all(16),<br>              child: Row(<br>                mainAxisAlignment: MainAxisAlignment.spaceBetween,<br>                children: [<br>                  const Text(<br>                    &quot;Available Cars&quot;,<br>                    style: TextStyle(<br>                      fontSize: 16,<br>                      fontWeight: FontWeight.bold,<br>                    ),<br>                  ),<br>                  TextButton(<br>                    onPressed: () {},<br>                    child: Text(<br>                      &quot;View All&quot;,<br>                      style: TextStyle(<br>                        color: Colors.blue[700],<br>                        fontWeight: FontWeight.w600,<br>                      ),<br>                    ),<br>                  ),<br>                ],<br>              ),<br>            ),<br><br>            // Car Grid<br>            StreamBuilder&lt;QuerySnapshot&gt;(<br>              stream: FirebaseFirestore.instance.collection(&#39;cars&#39;).snapshots(),<br>              builder: (context, snapshot) {<br>                if (!snapshot.hasData) {<br>                  return const Center(<br>                    child: Padding(<br>                      padding: EdgeInsets.all(20),<br>                      child: CircularProgressIndicator(),<br>                    ),<br>                  );<br>                }<br><br>                final cars = snapshot.data!.docs;<br><br>                return Padding(<br>                  padding: const EdgeInsets.symmetric(horizontal: 16),<br>                  child: GridView.builder(<br>                    shrinkWrap: true,<br>                    physics: const NeverScrollableScrollPhysics(),<br>                    gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(<br>                      crossAxisCount: 2,<br>                      childAspectRatio: 0.75,<br>                      crossAxisSpacing: 15,<br>                      mainAxisSpacing: 15,<br>                    ),<br>                    itemCount: cars.length,<br>                    itemBuilder: (context, index) {<br>                      final car = cars[index].data() as Map&lt;String, dynamic&gt;;<br>                      return PremiumCarCard(carData: car);<br>                    },<br>                  ),<br>                );<br>              },<br>            ),<br><br>            const SizedBox(height: 20),<br>          ],<br>        ),<br>      ),<br>      floatingActionButton: FloatingActionButton(<br>        onPressed: () {},<br>        backgroundColor: Colors.blue[700],<br>        child: const Icon(Icons.filter_list),<br>      ),<br>    );<br>  }<br>}<br><br>class PremiumCarCard extends StatelessWidget {<br>  final Map&lt;String, dynamic&gt; carData;<br><br>  const PremiumCarCard({super.key, required this.carData});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Container(<br>      decoration: BoxDecoration(<br>        color: Colors.white,<br>        borderRadius: BorderRadius.circular(16),<br>        boxShadow: [<br>          BoxShadow(<br>            color: Colors.black.withOpacity(0.05),<br>            blurRadius: 10,<br>            offset: const Offset(0, 5),<br>          ),<br>        ],<br>      ),<br>      child: Column(<br>        crossAxisAlignment: CrossAxisAlignment.start,<br>        children: [<br>          // Image with badge<br>          Expanded(<br>            flex: 3,<br>            child: Stack(<br>              children: [<br>                ClipRRect(<br>                  borderRadius: const BorderRadius.vertical(top: Radius.circular(16)),<br>                  child: CachedNetworkImage(<br>                    imageUrl: carData[&#39;imageUrl&#39;]?.toString() ?? &#39;&#39;,<br>                    height: double.infinity,<br>                    width: double.infinity,<br>                    fit: BoxFit.cover,<br>                    placeholder: (context, url) =&gt; Center(<br>                      child: CircularProgressIndicator(<br>                        strokeWidth: 2,<br>                        valueColor: AlwaysStoppedAnimation&lt;Color&gt;(Colors.blue[700]!),<br>                      ),<br>                    ),<br>                    errorWidget: (context, url, error) =&gt; const Center(<br>                      child: Icon(Icons.error_outline, color: Colors.red),<br>                    ),<br>                  ),<br>                ),<br>                Positioned(<br>                  top: 8,<br>                  right: 8,<br>                  child: Container(<br>                    padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 3),<br>                    decoration: BoxDecoration(<br>                      color: Colors.red,<br>                      borderRadius: BorderRadius.circular(4),<br>                    ),<br>                    child: Text(<br>                      carData[&#39;condition&#39;]?.toString() ?? &#39;NEW&#39;,<br>                      style: const TextStyle(<br>                        color: Colors.white,<br>                        fontSize: 10,<br>                        fontWeight: FontWeight.bold,<br>                      ),<br>                    ),<br>                  ),<br>                ),<br>                Positioned(<br>                  top: 8,<br>                  left: 8,<br>                  child: Container(<br>                    padding: const EdgeInsets.all(4),<br>                    decoration: BoxDecoration(<br>                      color: Colors.white.withOpacity(0.8),<br>                      shape: BoxShape.circle,<br>                    ),<br>                    child: Icon(<br>                      Icons.favorite_border,<br>                      size: 16,<br>                      color: Colors.red[700],<br>                    ),<br>                  ),<br>                ),<br>              ],<br>            ),<br>          ),<br><br>          // Car Details<br>          Expanded(<br>            flex: 4,<br>            child: Padding(<br>              padding: const EdgeInsets.all(12),<br>              child: Column(<br>                crossAxisAlignment: CrossAxisAlignment.start,<br>                children: [<br>                  // Car Name<br>                  Text(<br>                    carData[&#39;name&#39;]?.toString() ?? &#39;&#39;,<br>                    style: const TextStyle(<br>                      fontSize: 14,<br>                      fontWeight: FontWeight.bold,<br>                    ),<br>                    maxLines: 1,<br>                    overflow: TextOverflow.ellipsis,<br>                  ),<br>                  const SizedBox(height: 2),<br><br>                  // Price with badge<br>                  Row(<br>                    children: [<br>                      Container(<br>                        padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),<br>                        decoration: BoxDecoration(<br>                          color: Colors.blue[700],<br>                          borderRadius: BorderRadius.circular(4),<br>                        ),<br>                        child: Text(<br>                          &quot;₹ ${carData[&#39;price&#39;]?.toString() ?? &#39;&#39;}&quot;,<br>                          style: const TextStyle(<br>                            color: Colors.white,<br>                            fontSize: 12,<br>                            fontWeight: FontWeight.bold,<br>                          ),<br>                        ),<br>                      ),<br>                      const SizedBox(width: 6),<br>                      Text(<br>                        carData[&#39;ownership&#39;]?.toString() ?? &#39;&#39;,<br>                        style: TextStyle(<br>                          fontSize: 10,<br>                          color: Colors.grey[600],<br>                          fontWeight: FontWeight.w500,<br>                        ),<br>                      ),<br>                    ],<br>                  ),<br><br>                  const SizedBox(height: 8),<br><br>                  // Specs Row<br>                  Row(<br>                    mainAxisAlignment: MainAxisAlignment.spaceBetween,<br>                    children: [<br>                      buildSpecItem(Icons.calendar_today, carData[&#39;year&#39;]),<br>                      buildSpecItem(Icons.speed, &quot;${carData[&#39;kmsDriven&#39;]} km&quot;),<br>                      buildSpecItem(Icons.local_gas_station, carData[&#39;fuel&#39;]),<br>                    ],<br>                  ),<br><br>                  const Spacer(),<br><br>                  // Action Button<br>                  SizedBox(<br>                    width: double.infinity,<br>                    child: ElevatedButton(<br>                      onPressed: () async {<br>                        String contactNumber = carData[&#39;phonenumber&#39;]?.toString() ?? &#39;&#39;;<br>                        if (Platform.isAndroid || Platform.isIOS) {<br>                          String url = &#39;whatsapp://send?phone=$contactNumber&#39;;<br>                          try {<br>                            await launchUrl(Uri.parse(url));<br>                          } catch (e) {<br>                            print(&quot;Could not launch WhatsApp: $e&quot;);<br>                          }<br>                        }<br>                      },<br>                      style: ElevatedButton.styleFrom(<br>                        backgroundColor: Colors.blue[700],<br>                        foregroundColor: Colors.white,<br>                        shape: RoundedRectangleBorder(<br>                          borderRadius: BorderRadius.circular(8),<br>                        ),<br>                        padding: const EdgeInsets.symmetric(vertical: 8),<br>                      ),<br>                      child: const Text(<br>                        &quot;Contact Seller&quot;,<br>                        style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold),<br>                      ),<br>                    ),<br>                  ),<br>                ],<br>              ),<br>            ),<br>          ),<br>        ],<br>      ),<br>    );<br>  }<br><br>  Widget buildSpecItem(IconData icon, dynamic value) {<br>    return Column(<br>      children: [<br>        Icon(icon, size: 14, color: Colors.grey[600]),<br>        const SizedBox(height: 4),<br>        Text(<br>          value?.toString() ?? &#39;&#39;,<br>          style: TextStyle(<br>            fontSize: 10,<br>            fontWeight: FontWeight.w600,<br>            color: Colors.grey[800],<br>          ),<br>        ),<br>      ],<br>    );<br>  }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b3e35c95d9c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Signup Page Steper]]></title>
            <link>https://sandeepkumaredugaon.medium.com/signup-page-steper-6066cbb5ebb4?source=rss-0fc1a07cda66------2</link>
            <guid isPermaLink="false">https://medium.com/p/6066cbb5ebb4</guid>
            <dc:creator><![CDATA[Sandeep Kumar]]></dc:creator>
            <pubDate>Mon, 05 May 2025 07:15:10 GMT</pubDate>
            <atom:updated>2025-05-05T07:15:10.719Z</atom:updated>
            <content:encoded><![CDATA[<pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter/services.dart&#39;;<br>import &#39;dart:ui&#39;;<br><br>class PremiumSignupPage extends StatefulWidget {<br>  const PremiumSignupPage({Key? key}) : super(key: key);<br><br>  @override<br>  State&lt;PremiumSignupPage&gt; createState() =&gt; _PremiumSignupPageState();<br>}<br><br>class _PremiumSignupPageState extends State&lt;PremiumSignupPage&gt; with SingleTickerProviderStateMixin {<br>  final _formKey = GlobalKey&lt;FormState&gt;();<br>  final _nameController = TextEditingController();<br>  final _emailController = TextEditingController();<br>  final _phoneController = TextEditingController();<br>  final _addressController = TextEditingController();<br>  final _passwordController = TextEditingController();<br>  final _confirmPasswordController = TextEditingController();<br>  bool _isPasswordVisible = false;<br>  bool _isConfirmPasswordVisible = false;<br>  bool _agreeToTerms = false;<br><br>  // Animation controllers<br>  late AnimationController _animationController;<br>  late Animation&lt;double&gt; _fadeAnimation;<br>  late Animation&lt;Offset&gt; _slideAnimation;<br><br>  int _currentStep = 0;<br>  final _pageController = PageController();<br><br>  @override<br>  void initState() {<br>    super.initState();<br>    _animationController = AnimationController(<br>      vsync: this,<br>      duration: const Duration(milliseconds: 1000),<br>    );<br><br>    _fadeAnimation = Tween&lt;double&gt;(<br>      begin: 0.0,<br>      end: 1.0,<br>    ).animate(CurvedAnimation(<br>      parent: _animationController,<br>      curve: Curves.easeIn,<br>    ));<br><br>    _slideAnimation = Tween&lt;Offset&gt;(<br>      begin: const Offset(0, 0.1),<br>      end: Offset.zero,<br>    ).animate(CurvedAnimation(<br>      parent: _animationController,<br>      curve: Curves.easeOut,<br>    ));<br><br>    _animationController.forward();<br>  }<br><br>  @override<br>  void dispose() {<br>    _nameController.dispose();<br>    _emailController.dispose();<br>    _phoneController.dispose();<br>    _addressController.dispose();<br>    _passwordController.dispose();<br>    _confirmPasswordController.dispose();<br>    _animationController.dispose();<br>    _pageController.dispose();<br>    super.dispose();<br>  }<br><br>  void _nextStep() {<br>    // Validate current step before moving to next<br>    if (_currentStep == 0) {<br>      // Validate first step (personal info)<br>      if (_nameController.text.isEmpty ||<br>          _emailController.text.isEmpty ||<br>          !RegExp(r&#39;^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$&#39;).hasMatch(_emailController.text)) {<br>        // Show error<br>        ScaffoldMessenger.of(context).showSnackBar(<br>          const SnackBar(content: Text(&#39;Please complete all fields correctly&#39;)),<br>        );<br>        return;<br>      }<br>    } else if (_currentStep == 1) {<br>      // Validate second step (contact info)<br>      if (_phoneController.text.length &lt; 10 || _addressController.text.length &lt; 10) {<br>        ScaffoldMessenger.of(context).showSnackBar(<br>          const SnackBar(content: Text(&#39;Please complete all fields correctly&#39;)),<br>        );<br>        return;<br>      }<br>    }<br><br>    if (_currentStep &lt; 2) {<br>      setState(() {<br>        _currentStep++;<br>      });<br>      _pageController.animateToPage(<br>        _currentStep,<br>        duration: const Duration(milliseconds: 400),<br>        curve: Curves.easeInOut,<br>      );<br>      _animationController.reset();<br>      _animationController.forward();<br>    }<br>  }<br><br>  void _previousStep() {<br>    if (_currentStep &gt; 0) {<br>      setState(() {<br>        _currentStep--;<br>      });<br>      _pageController.animateToPage(<br>        _currentStep,<br>        duration: const Duration(milliseconds: 400),<br>        curve: Curves.easeInOut,<br>      );<br>      _animationController.reset();<br>      _animationController.forward();<br>    }<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      body: Container(<br>        decoration: BoxDecoration(<br>          gradient: LinearGradient(<br>            begin: Alignment.topLeft,<br>            end: Alignment.bottomRight,<br>            colors: [<br>              Colors.blue.shade800,<br>              Colors.indigo.shade900,<br>            ],<br>          ),<br>        ),<br>        child: SafeArea(<br>          child: Stack(<br>            children: [<br>              // Blurred background circles for design<br>              Positioned(<br>                top: -100,<br>                right: -100,<br>                child: Container(<br>                  width: 300,<br>                  height: 300,<br>                  decoration: BoxDecoration(<br>                    shape: BoxShape.circle,<br>                    color: Colors.white.withOpacity(0.1),<br>                  ),<br>                ),<br>              ),<br>              Positioned(<br>                bottom: -150,<br>                left: -70,<br>                child: Container(<br>                  width: 350,<br>                  height: 350,<br>                  decoration: BoxDecoration(<br>                    shape: BoxShape.circle,<br>                    color: Colors.white.withOpacity(0.1),<br>                  ),<br>                ),<br>              ),<br><br>              // Header and content<br>              Column(<br>                children: [<br>                  // Header<br>                  Padding(<br>                    padding: const EdgeInsets.all(24.0),<br>                    child: Row(<br>                      mainAxisAlignment: MainAxisAlignment.spaceBetween,<br>                      children: [<br>                        // Back button<br>                        IconButton(<br>                          icon: const Icon(Icons.arrow_back, color: Colors.white),<br>                          onPressed: _currentStep &gt; 0 ? _previousStep : () {<br>                            Navigator.of(context).pop();<br>                          },<br>                        ),<br>                        // Title<br>                        const Text(<br>                          &#39;Create Account&#39;,<br>                          style: TextStyle(<br>                            color: Colors.white,<br>                            fontWeight: FontWeight.bold,<br>                            fontSize: 20,<br>                          ),<br>                        ),<br>                        // Placeholder for alignment<br>                        const SizedBox(width: 48),<br>                      ],<br>                    ),<br>                  ),<br><br>                  // Progress indicators<br>                  Padding(<br>                    padding: const EdgeInsets.symmetric(horizontal: 32.0),<br>                    child: Row(<br>                      children: [<br>                        _buildStepIndicator(0, &quot;Personal&quot;),<br>                        _buildStepConnector(_currentStep &gt;= 1),<br>                        _buildStepIndicator(1, &quot;Contact&quot;),<br>                        _buildStepConnector(_currentStep &gt;= 2),<br>                        _buildStepIndicator(2, &quot;Security&quot;),<br>                      ],<br>                    ),<br>                  ),<br>                  const SizedBox(height: 20),<br><br>                  // Main content - Card with form<br>                  Expanded(<br>                    child: Container(<br>                      margin: const EdgeInsets.all(24),<br>                      decoration: BoxDecoration(<br>                        color: Colors.white,<br>                        borderRadius: BorderRadius.circular(24),<br>                        boxShadow: [<br>                          BoxShadow(<br>                            color: Colors.black.withOpacity(0.2),<br>                            blurRadius: 20,<br>                            offset: const Offset(0, 10),<br>                          ),<br>                        ],<br>                      ),<br>                      child: ClipRRect(<br>                        borderRadius: BorderRadius.circular(24),<br>                        child: BackdropFilter(<br>                          filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),<br>                          child: PageView(<br>                            controller: _pageController,<br>                            physics: const NeverScrollableScrollPhysics(),<br>                            children: [<br>                              // Step 1: Personal Information<br>                              _buildPersonalInfoStep(),<br><br>                              // Step 2: Contact Information<br>                              _buildContactInfoStep(),<br><br>                              // Step 3: Security Information<br>                              _buildSecurityInfoStep(),<br>                            ],<br>                          ),<br>                        ),<br>                      ),<br>                    ),<br>                  ),<br>                ],<br>              ),<br>            ],<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br><br>  Widget _buildStepIndicator(int step, String label) {<br>    final isActive = _currentStep &gt;= step;<br>    return Expanded(<br>      child: Column(<br>        children: [<br>          Container(<br>            width: 40,<br>            height: 40,<br>            decoration: BoxDecoration(<br>              color: isActive ? Colors.white : Colors.white.withOpacity(0.3),<br>              shape: BoxShape.circle,<br>              boxShadow: isActive<br>                  ? [<br>                BoxShadow(<br>                  color: Colors.white.withOpacity(0.3),<br>                  blurRadius: 10,<br>                  spreadRadius: 5,<br>                )<br>              ]<br>                  : null,<br>            ),<br>            child: Center(<br>              child: _currentStep &gt; step<br>                  ? const Icon(Icons.check, color: Colors.green)<br>                  : Text(<br>                &#39;${step + 1}&#39;,<br>                style: TextStyle(<br>                  color: isActive ? Colors.blue.shade900 : Colors.white,<br>                  fontWeight: FontWeight.bold,<br>                ),<br>              ),<br>            ),<br>          ),<br>          const SizedBox(height: 8),<br>          Text(<br>            label,<br>            style: TextStyle(<br>              color: isActive ? Colors.white : Colors.white.withOpacity(0.7),<br>              fontWeight: isActive ? FontWeight.bold : FontWeight.normal,<br>            ),<br>          ),<br>        ],<br>      ),<br>    );<br>  }<br><br>  Widget _buildStepConnector(bool isActive) {<br>    return Container(<br>      width: 40,<br>      height: 2,<br>      color: isActive ? Colors.white : Colors.white.withOpacity(0.3),<br>    );<br>  }<br><br>  Widget _buildPersonalInfoStep() {<br>    return FadeTransition(<br>      opacity: _fadeAnimation,<br>      child: SlideTransition(<br>        position: _slideAnimation,<br>        child: Padding(<br>          padding: const EdgeInsets.all(24.0),<br>          child: Column(<br>            crossAxisAlignment: CrossAxisAlignment.start,<br>            children: [<br>              // Header<br>              Text(<br>                &#39;Personal Information&#39;,<br>                style: TextStyle(<br>                  fontSize: 22,<br>                  fontWeight: FontWeight.bold,<br>                  color: Colors.blue.shade900,<br>                ),<br>              ),<br>              const SizedBox(height: 8),<br>              Text(<br>                &#39;Please provide your personal details&#39;,<br>                style: TextStyle(<br>                  fontSize: 14,<br>                  color: Colors.grey.shade600,<br>                ),<br>              ),<br>              const SizedBox(height: 32),<br><br>              // Full Name<br>              _buildPremiumTextField(<br>                controller: _nameController,<br>                label: &#39;Full Name&#39;,<br>                hint: &#39;Enter your full name&#39;,<br>                prefixIcon: Icons.person_outline,<br>                validator: (value) {<br>                  if (value == null || value.isEmpty) {<br>                    return &#39;Please enter your name&#39;;<br>                  }<br>                  return null;<br>                },<br>              ),<br>              const SizedBox(height: 24),<br><br>              // Email<br>              _buildPremiumTextField(<br>                controller: _emailController,<br>                label: &#39;Email Address&#39;,<br>                hint: &#39;example@email.com&#39;,<br>                prefixIcon: Icons.email_outlined,<br>                keyboardType: TextInputType.emailAddress,<br>                validator: (value) {<br>                  if (value == null || value.isEmpty) {<br>                    return &#39;Please enter your email&#39;;<br>                  }<br>                  if (!RegExp(r&#39;^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$&#39;).hasMatch(value)) {<br>                    return &#39;Please enter a valid email&#39;;<br>                  }<br>                  return null;<br>                },<br>              ),<br><br>              const Spacer(),<br><br>              // Next button<br>              _buildGradientButton(<br>                text: &#39;Next&#39;,<br>                onPressed: _nextStep,<br>                icon: Icons.arrow_forward,<br>              ),<br>            ],<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br><br>  Widget _buildContactInfoStep() {<br>    return FadeTransition(<br>      opacity: _fadeAnimation,<br>      child: SlideTransition(<br>        position: _slideAnimation,<br>        child: Padding(<br>          padding: const EdgeInsets.all(24.0),<br>          child: Column(<br>            crossAxisAlignment: CrossAxisAlignment.start,<br>            children: [<br>              // Header<br>              Text(<br>                &#39;Contact Information&#39;,<br>                style: TextStyle(<br>                  fontSize: 22,<br>                  fontWeight: FontWeight.bold,<br>                  color: Colors.blue.shade900,<br>                ),<br>              ),<br>              const SizedBox(height: 8),<br>              Text(<br>                &#39;How can we reach you?&#39;,<br>                style: TextStyle(<br>                  fontSize: 14,<br>                  color: Colors.grey.shade600,<br>                ),<br>              ),<br>              const SizedBox(height: 32),<br><br>              // Phone Number<br>              _buildPremiumTextField(<br>                controller: _phoneController,<br>                label: &#39;Phone Number&#39;,<br>                hint: &#39;(123) 456-7890&#39;,<br>                prefixIcon: Icons.phone_outlined,<br>                keyboardType: TextInputType.phone,<br>                inputFormatters: [<br>                  FilteringTextInputFormatter.digitsOnly,<br>                  LengthLimitingTextInputFormatter(10),<br>                ],<br>                validator: (value) {<br>                  if (value == null || value.isEmpty) {<br>                    return &#39;Please enter your phone number&#39;;<br>                  }<br>                  if (value.length &lt; 10) {<br>                    return &#39;Please enter a valid phone number&#39;;<br>                  }<br>                  return null;<br>                },<br>              ),<br>              const SizedBox(height: 24),<br><br>              // Address<br>              _buildPremiumTextField(<br>                controller: _addressController,<br>                label: &#39;Address&#39;,<br>                hint: &#39;Enter your full address&#39;,<br>                prefixIcon: Icons.home_outlined,<br>                maxLines: 3,<br>                validator: (value) {<br>                  if (value == null || value.isEmpty) {<br>                    return &#39;Please enter your address&#39;;<br>                  }<br>                  return null;<br>                },<br>              ),<br><br>              const Spacer(),<br><br>              // Next button<br>              _buildGradientButton(<br>                text: &#39;Next&#39;,<br>                onPressed: _nextStep,<br>                icon: Icons.arrow_forward,<br>              ),<br>            ],<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br><br>  Widget _buildSecurityInfoStep() {<br>    return FadeTransition(<br>      opacity: _fadeAnimation,<br>      child: SlideTransition(<br>        position: _slideAnimation,<br>        child: Padding(<br>          padding: const EdgeInsets.all(24.0),<br>          child: Column(<br>            crossAxisAlignment: CrossAxisAlignment.start,<br>            children: [<br>              // Header<br>              Text(<br>                &#39;Security&#39;,<br>                style: TextStyle(<br>                  fontSize: 22,<br>                  fontWeight: FontWeight.bold,<br>                  color: Colors.blue.shade900,<br>                ),<br>              ),<br>              const SizedBox(height: 8),<br>              Text(<br>                &#39;Create a secure password&#39;,<br>                style: TextStyle(<br>                  fontSize: 14,<br>                  color: Colors.grey.shade600,<br>                ),<br>              ),<br>              const SizedBox(height: 32),<br><br>              // Password<br>              _buildPasswordField(<br>                controller: _passwordController,<br>                label: &#39;Password&#39;,<br>                hint: &#39;Create a strong password&#39;,<br>                isVisible: _isPasswordVisible,<br>                onToggleVisibility: () {<br>                  setState(() {<br>                    _isPasswordVisible = !_isPasswordVisible;<br>                  });<br>                },<br>              ),<br>              const SizedBox(height: 8),<br><br>              // Password strength indicator<br>              _buildPasswordStrengthIndicator(_passwordController.text),<br><br>              const SizedBox(height: 24),<br><br>              // Confirm Password<br>              _buildPasswordField(<br>                controller: _confirmPasswordController,<br>                label: &#39;Confirm Password&#39;,<br>                hint: &#39;Re-enter your password&#39;,<br>                isVisible: _isConfirmPasswordVisible,<br>                onToggleVisibility: () {<br>                  setState(() {<br>                    _isConfirmPasswordVisible = !_isConfirmPasswordVisible;<br>                  });<br>                },<br>              ),<br>              const SizedBox(height: 24),<br><br>              // Terms and Conditions<br>              Material(<br>                color: Colors.transparent,<br>                child: InkWell(<br>                  onTap: () {<br>                    setState(() {<br>                      _agreeToTerms = !_agreeToTerms;<br>                    });<br>                  },<br>                  borderRadius: BorderRadius.circular(12),<br>                  child: Padding(<br>                    padding: const EdgeInsets.symmetric(vertical: 8.0),<br>                    child: Row(<br>                      children: [<br>                        AnimatedContainer(<br>                          duration: const Duration(milliseconds: 200),<br>                          width: 24,<br>                          height: 24,<br>                          decoration: BoxDecoration(<br>                            borderRadius: BorderRadius.circular(6),<br>                            color: _agreeToTerms ? Colors.blue.shade800 : Colors.white,<br>                            border: Border.all(<br>                              color: _agreeToTerms ? Colors.blue.shade800 : Colors.grey.shade400,<br>                              width: 2,<br>                            ),<br>                            boxShadow: _agreeToTerms<br>                                ? [<br>                              BoxShadow(<br>                                color: Colors.blue.shade100,<br>                                blurRadius: 8,<br>                                spreadRadius: 1,<br>                              )<br>                            ]<br>                                : null,<br>                          ),<br>                          child: _agreeToTerms<br>                              ? const Center(<br>                            child: Icon(<br>                              Icons.check,<br>                              color: Colors.white,<br>                              size: 16,<br>                            ),<br>                          )<br>                              : null,<br>                        ),<br>                        const SizedBox(width: 12),<br>                        Expanded(<br>                          child: RichText(<br>                            text: TextSpan(<br>                              style: TextStyle(<br>                                color: Colors.grey.shade700,<br>                                fontSize: 14,<br>                              ),<br>                              children: [<br>                                const TextSpan(text: &#39;I agree to the &#39;),<br>                                TextSpan(<br>                                  text: &#39;Terms of Service&#39;,<br>                                  style: TextStyle(<br>                                    color: Colors.blue.shade800,<br>                                    fontWeight: FontWeight.bold,<br>                                  ),<br>                                ),<br>                                const TextSpan(text: &#39; and &#39;),<br>                                TextSpan(<br>                                  text: &#39;Privacy Policy&#39;,<br>                                  style: TextStyle(<br>                                    color: Colors.blue.shade800,<br>                                    fontWeight: FontWeight.bold,<br>                                  ),<br>                                ),<br>                              ],<br>                            ),<br>                          ),<br>                        ),<br>                      ],<br>                    ),<br>                  ),<br>                ),<br>              ),<br><br>              const Spacer(),<br><br>              // Create Account button<br>              _buildGradientButton(<br>                text: &#39;Create Account&#39;,<br>                onPressed: _agreeToTerms<br>                    ? () {<br>                  if (_passwordController.text.isNotEmpty &amp;&amp;<br>                      _passwordController.text == _confirmPasswordController.text) {<br>                    // Show success animation<br>                    _showSuccessDialog();<br>                  } else {<br>                    ScaffoldMessenger.of(context).showSnackBar(<br>                      const SnackBar(content: Text(&#39;Please check your passwords&#39;)),<br>                    );<br>                  }<br>                }<br>                    : null,<br>                icon: Icons.check,<br>              ),<br><br>              const SizedBox(height: 16),<br><br>              // Already have an account<br>              Center(<br>                child: Row(<br>                  mainAxisAlignment: MainAxisAlignment.center,<br>                  children: [<br>                    Text(<br>                      &#39;Already have an account? &#39;,<br>                      style: TextStyle(color: Colors.grey.shade600),<br>                    ),<br>                    GestureDetector(<br>                      onTap: () {<br>                        Navigator.pop(context);<br>                      },<br>                      child: Text(<br>                        &#39;Login&#39;,<br>                        style: TextStyle(<br>                          color: Colors.blue.shade800,<br>                          fontWeight: FontWeight.bold,<br>                        ),<br>                      ),<br>                    ),<br>                  ],<br>                ),<br>              ),<br>            ],<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br><br>  Widget _buildPremiumTextField({<br>    required TextEditingController controller,<br>    required String label,<br>    required String hint,<br>    required IconData prefixIcon,<br>    TextInputType keyboardType = TextInputType.text,<br>    List&lt;TextInputFormatter&gt;? inputFormatters,<br>    String? Function(String?)? validator,<br>    int maxLines = 1,<br>  }) {<br>    return Column(<br>      crossAxisAlignment: CrossAxisAlignment.start,<br>      children: [<br>        Text(<br>          label,<br>          style: TextStyle(<br>            fontSize: 14,<br>            fontWeight: FontWeight.bold,<br>            color: Colors.grey.shade800,<br>          ),<br>        ),<br>        const SizedBox(height: 8),<br>        Container(<br>          decoration: BoxDecoration(<br>            color: Colors.grey.shade50,<br>            borderRadius: BorderRadius.circular(16),<br>            boxShadow: [<br>              BoxShadow(<br>                color: Colors.grey.shade200,<br>                blurRadius: 10,<br>                offset: const Offset(0, 4),<br>              ),<br>            ],<br>          ),<br>          child: TextFormField(<br>            controller: controller,<br>            keyboardType: keyboardType,<br>            maxLines: maxLines,<br>            inputFormatters: inputFormatters,<br>            style: TextStyle(color: Colors.grey.shade800),<br>            decoration: InputDecoration(<br>              hintText: hint,<br>              hintStyle: TextStyle(color: Colors.grey.shade400),<br>              prefixIcon: Icon(<br>                prefixIcon,<br>                color: Colors.blue.shade800,<br>              ),<br>              border: OutlineInputBorder(<br>                borderRadius: BorderRadius.circular(16),<br>                borderSide: BorderSide.none,<br>              ),<br>              enabledBorder: OutlineInputBorder(<br>                borderRadius: BorderRadius.circular(16),<br>                borderSide: BorderSide.none,<br>              ),<br>              focusedBorder: OutlineInputBorder(<br>                borderRadius: BorderRadius.circular(16),<br>                borderSide: BorderSide(color: Colors.blue.shade800, width: 1.5),<br>              ),<br>              contentPadding: const EdgeInsets.symmetric(<br>                horizontal: 16,<br>                vertical: 16,<br>              ),<br>            ),<br>            validator: validator,<br>          ),<br>        ),<br>      ],<br>    );<br>  }<br><br>  Widget _buildPasswordField({<br>    required TextEditingController controller,<br>    required String label,<br>    required String hint,<br>    required bool isVisible,<br>    required VoidCallback onToggleVisibility,<br>  }) {<br>    return Column(<br>      crossAxisAlignment: CrossAxisAlignment.start,<br>      children: [<br>        Text(<br>          label,<br>          style: TextStyle(<br>            fontSize: 14,<br>            fontWeight: FontWeight.bold,<br>            color: Colors.grey.shade800,<br>          ),<br>        ),<br>        const SizedBox(height: 8),<br>        Container(<br>          decoration: BoxDecoration(<br>            color: Colors.grey.shade50,<br>            borderRadius: BorderRadius.circular(16),<br>            boxShadow: [<br>              BoxShadow(<br>                color: Colors.grey.shade200,<br>                blurRadius: 10,<br>                offset: const Offset(0, 4),<br>              ),<br>            ],<br>          ),<br>          child: TextFormField(<br>            controller: controller,<br>            obscureText: !isVisible,<br>            style: TextStyle(color: Colors.grey.shade800),<br>            decoration: InputDecoration(<br>              hintText: hint,<br>              hintStyle: TextStyle(color: Colors.grey.shade400),<br>              prefixIcon: Icon(<br>                Icons.lock_outline,<br>                color: Colors.blue.shade800,<br>              ),<br>              suffixIcon: IconButton(<br>                icon: Icon(<br>                  isVisible ? Icons.visibility_outlined : Icons.visibility_off_outlined,<br>                  color: Colors.grey.shade600,<br>                ),<br>                onPressed: onToggleVisibility,<br>              ),<br>              border: OutlineInputBorder(<br>                borderRadius: BorderRadius.circular(16),<br>                borderSide: BorderSide.none,<br>              ),<br>              enabledBorder: OutlineInputBorder(<br>                borderRadius: BorderRadius.circular(16),<br>                borderSide: BorderSide.none,<br>              ),<br>              focusedBorder: OutlineInputBorder(<br>                borderRadius: BorderRadius.circular(16),<br>                borderSide: BorderSide(color: Colors.blue.shade800, width: 1.5),<br>              ),<br>              contentPadding: const EdgeInsets.symmetric(<br>                horizontal: 16,<br>                vertical: 16,<br>              ),<br>            ),<br>          ),<br>        ),<br>      ],<br>    );<br>  }<br><br>  Widget _buildPasswordStrengthIndicator(String password) {<br>    // Calculate password strength<br>    int strength = 0;<br>    if (password.length &gt;= 8) strength++;<br>    if (password.contains(RegExp(r&#39;[A-Z]&#39;))) strength++;<br>    if (password.contains(RegExp(r&#39;[a-z]&#39;))) strength++;<br>    if (password.contains(RegExp(r&#39;[0-9]&#39;))) strength++;<br>    if (password.contains(RegExp(r&#39;[!@#$%^&amp;*(),.?&quot;:{}|&lt;&gt;]&#39;))) strength++;<br><br>    Color strengthColor = Colors.transparent;<br>    String strengthText = &#39;&#39;;<br><br>    if (password.isEmpty) {<br>      strengthText = &#39;&#39;;<br>    } else if (strength &lt; 2) {<br>      strengthColor = Colors.red;<br>      strengthText = &#39;Weak&#39;;<br>    } else if (strength &lt; 4) {<br>      strengthColor = Colors.orange;<br>      strengthText = &#39;Medium&#39;;<br>    } else {<br>      strengthColor = Colors.green;<br>      strengthText = &#39;Strong&#39;;<br>    }<br><br>    return Column(<br>      crossAxisAlignment: CrossAxisAlignment.start,<br>      children: [<br>        // Password strength indicators<br>        Row(<br>          children: List.generate(5, (index) {<br>            return Expanded(<br>              child: Container(<br>                height: 4,<br>                margin: const EdgeInsets.symmetric(horizontal: 2),<br>                decoration: BoxDecoration(<br>                  color: index &lt; strength ? strengthColor : Colors.grey.shade300,<br>                  borderRadius: BorderRadius.circular(2),<br>                ),<br>              ),<br>            );<br>          }),<br>        ),<br>        if (strengthText.isNotEmpty)<br>          Padding(<br>            padding: const EdgeInsets.only(top: 8.0),<br>            child: Text(<br>              &#39;Password Strength: $strengthText&#39;,<br>              style: TextStyle(<br>                fontSize: 12,<br>                color: strengthColor,<br>                fontWeight: FontWeight.bold,<br>              ),<br>            ),<br>          ),<br>      ],<br>    );<br>  }<br><br>  Widget _buildGradientButton({<br>    required String text,<br>    required VoidCallback? onPressed,<br>    required IconData icon,<br>  }) {<br>    return ElevatedButton(<br>      onPressed: onPressed,<br>      style: ElevatedButton.styleFrom(<br>        padding: EdgeInsets.zero,<br>        shape: RoundedRectangleBorder(<br>          borderRadius: BorderRadius.circular(16),<br>        ),<br>        elevation: 0,<br>      ),<br>      child: Ink(<br>        decoration: BoxDecoration(<br>          gradient: LinearGradient(<br>            colors: onPressed == null<br>                ? [Colors.grey.shade400, Colors.grey.shade500]<br>                : [Colors.blue.shade600, Colors.indigo.shade900],<br>            begin: Alignment.centerLeft,<br>            end: Alignment.centerRight,<br>          ),<br>          borderRadius: BorderRadius.circular(16),<br>        ),<br>        child: Container(<br>          height: 60,<br>          alignment: Alignment.center,<br>          child: Row(<br>            mainAxisAlignment: MainAxisAlignment.center,<br>            children: [<br>              Text(<br>                text,<br>                style: const TextStyle(<br>                  fontSize: 16,<br>                  fontWeight: FontWeight.bold,<br>                  color: Colors.white,<br>                ),<br>              ),<br>              const SizedBox(width: 12),<br>              Icon(<br>                icon,<br>                color: Colors.white,<br>              ),<br>            ],<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br><br>  void _showSuccessDialog() {<br>    showGeneralDialog(<br>      context: context,<br>      barrierDismissible: false,<br>      barrierLabel: &quot;Success Dialog&quot;,<br>      pageBuilder: (_, __, ___) {<br>        return Container();<br>      },<br>      transitionBuilder: (_, animation, __, ___) {<br>        return ScaleTransition(<br>          scale: CurvedAnimation(<br>            parent: animation,<br>            curve: Curves.easeOutBack,<br>          ),<br>          child: AlertDialog(<br>            shape: RoundedRectangleBorder(<br>              borderRadius: BorderRadius.circular(24),<br>            ),<br>            backgroundColor: Colors.white,<br>            content: Column(<br>              mainAxisSize: MainAxisSize.min,<br>              children: [<br>                Container(<br>                  padding: const EdgeInsets.all(20),<br>                  decoration: BoxDecoration(<br>                    shape: BoxShape.circle,<br>                    color: Colors.green.shade100,<br>                  ),<br>                  child: Icon(<br>                    Icons.check,<br>                    size: 60,<br>                    color: Colors.green.shade700,<br>                  ),<br>                ),<br>                const SizedBox(height: 24),<br>                const Text(<br>                  &#39;Account Created Successfully!&#39;,<br>                  style: TextStyle(<br>                    fontSize: 20,<br>                    fontWeight: FontWeight.bold,<br>                  ),<br>                  textAlign: TextAlign.center,<br>                ),<br>                const SizedBox(height: 16),<br>                Text(<br>                  &#39;Your account has been created. You can now log in with your credentials.&#39;,<br>                  style: TextStyle(<br>                    fontSize: 16,<br>                    color: Colors.grey.shade600,<br>                  ),<br>                  textAlign: TextAlign.center,<br>                ),<br>                const SizedBox(height: 24),<br>                ElevatedButton(<br>                  onPressed: () {<br>                    Navigator.of(context).pop();<br>                    Navigator.of(context).pop(); // Go back to login<br>                  },<br>                  style: ElevatedButton.styleFrom(<br>                    backgroundColor: Colors.green.shade600,<br>                    foregroundColor: Colors.white,<br>                    padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 32),<br>                    shape: RoundedRectangleBorder(<br>                      borderRadius: BorderRadius.circular(16),<br>                    ),<br>                  ),<br>                  child: const Text(<br>                    &#39;Go to Login&#39;,<br>                    style: TextStyle(<br>                      fontSize: 16,<br>                      fontWeight: FontWeight.bold,<br>                    ),<br>                  ),<br>                ),<br>              ],<br>            ),<br>          ),<br>        );<br>      },<br>      transitionDuration: const Duration(milliseconds: 400),<br>    );<br>  }<br>}<br><br>// To use this signup page:<br>/*<br>Navigator.push(<br>  context,<br>  MaterialPageRoute(builder: (context) =&gt; const PremiumSignupPage()),<br>);<br>*/</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6066cbb5ebb4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Contact Acess Page Ui Design flutt]]></title>
            <link>https://sandeepkumaredugaon.medium.com/contact-acess-page-ui-design-flutt-6ed1a8fdbd1f?source=rss-0fc1a07cda66------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ed1a8fdbd1f</guid>
            <dc:creator><![CDATA[Sandeep Kumar]]></dc:creator>
            <pubDate>Wed, 26 Mar 2025 01:46:34 GMT</pubDate>
            <atom:updated>2025-03-26T01:46:34.596Z</atom:updated>
            <content:encoded><![CDATA[<h3>Contact Acess Page Ui Design flutter se</h3><pre>  permission_handler: ^11.3.1<br>  contacts_service: ^0.6.3</pre><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:permission_handler/permission_handler.dart&#39;;<br>import &#39;package:contacts_service/contacts_service.dart&#39;;<br><br>class ContactsPage extends StatefulWidget {<br>  @override<br>  _ContactsPageState createState() =&gt; _ContactsPageState();<br>}<br><br>class _ContactsPageState extends State&lt;ContactsPage&gt; {<br>  List&lt;Contact&gt; _contacts = [];<br>  List&lt;Contact&gt; _filteredContacts = [];<br>  bool _isSearching = false; // Yeh track karega ki search ho raha hai ya nahi<br><br>  @override<br>  void initState() {<br>    super.initState();<br>    _requestPermission();<br>  }<br><br>  Future&lt;void&gt; _requestPermission() async {<br>    if (await Permission.contacts.request().isGranted) {<br>      _fetchContacts();<br>    } else {<br>      print(&quot;Permission denied&quot;);<br>    }<br>  }<br><br>  Future&lt;void&gt; _fetchContacts() async {<br>    Iterable&lt;Contact&gt; contacts = await ContactsService.getContacts();<br>    setState(() {<br>      _contacts = contacts.toList();<br>      _filteredContacts = _contacts;<br>    });<br>  }<br><br>  void _filterContacts(String query) {<br>    setState(() {<br>      _isSearching = query.isNotEmpty;<br>      _filteredContacts = _contacts<br>          .where((contact) =&gt;<br>      contact.displayName != null &amp;&amp;<br>          contact.displayName!.toLowerCase().contains(query.toLowerCase()))<br>          .toList();<br>    });<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(<br>        leading: IconButton(onPressed: (){<br>          Navigator.pop(context);<br><br>        }, icon: Icon(Icons.arrow_back,color: Colors.white,)),<br>        title: Text(&quot;Contacts&quot;,<br>            style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold,color: Colors.white)),<br>        backgroundColor: Colors.deepPurple,<br>      ),<br>      body: Column(<br>        children: [<br>          // 🔍 Search Box<br>          Padding(<br>            padding: const EdgeInsets.all(10.0),<br>            child: TextField(<br>              onChanged: _filterContacts,<br>              decoration: InputDecoration(<br>                hintText: &quot;Search contacts...&quot;,<br>                prefixIcon: Icon(Icons.search),<br>                filled: true,<br>                fillColor: Colors.white,<br>                border:<br>                OutlineInputBorder(borderRadius: BorderRadius.circular(10)),<br>              ),<br>            ),<br>          ),<br>          // 📜 Contact List<br>          Expanded(<br>            child: _isSearching &amp;&amp; _filteredContacts.isEmpty<br>                ? Center(<br>              child: Text(<br>                &quot;No results found&quot;,<br>                style: TextStyle(<br>                    fontSize: 18,<br>                    fontWeight: FontWeight.bold,<br>                    color: Colors.grey),<br>              ),<br>            )<br>                : _filteredContacts.isEmpty<br>                ? Center(child: CircularProgressIndicator())<br>                : ListView.builder(<br>              itemCount: _filteredContacts.length,<br>              itemBuilder: (context, index) {<br>                Contact contact = _filteredContacts[index];<br>                return ListTile(<br>                  leading: CircleAvatar(<br>                    backgroundColor: Colors.deepPurple,<br>                    child: contact.avatar != null &amp;&amp;<br>                        contact.avatar!.isNotEmpty<br>                        ? ClipOval(child: Image.memory(contact.avatar!))<br>                        : Text(contact.initials(),<br>                        style: TextStyle(color: Colors.white)),<br>                  ),<br>                  title: Text(contact.displayName ?? &quot;No Name&quot;,<br>                      style: TextStyle(fontWeight: FontWeight.bold)),<br>                  subtitle: Text(contact.phones!.isNotEmpty<br>                      ? contact.phones!.first.value ?? &quot;&quot;<br>                      : &quot;No Number&quot;),<br>                  trailing: Icon(Icons.arrow_forward_ios,<br>                      color: Colors.grey),<br>                );<br>              },<br>            ),<br>          ),<br>        ],<br>      ),<br>    );<br>  }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ed1a8fdbd1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>