<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anin Arafath</title>
    <description>The latest articles on DEV Community by Anin Arafath (@aninarafath6).</description>
    <link>https://dev.to/aninarafath6</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F700886%2F0de0b725-3564-41f9-b977-5d07338a43e2.jpeg</url>
      <title>DEV Community: Anin Arafath</title>
      <link>https://dev.to/aninarafath6</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aninarafath6"/>
    <language>en</language>
    <item>
      <title>Staircase Problem solution hacker rank</title>
      <dc:creator>Anin Arafath</dc:creator>
      <pubDate>Mon, 28 Mar 2022 05:13:55 +0000</pubDate>
      <link>https://dev.to/aninarafath6/staircase-problem-solution-hacker-rank-31fo</link>
      <guid>https://dev.to/aninarafath6/staircase-problem-solution-hacker-rank-31fo</guid>
      <description>&lt;p&gt;Staircase detail&lt;br&gt;
This is a staircase of size n =4&lt;/p&gt;

&lt;p&gt;.....#&lt;br&gt;
....##&lt;br&gt;
...###&lt;br&gt;
.####&lt;/p&gt;

&lt;p&gt;Its base and height are both equal to n . It is drawn using # symbols and spaces. The last line is not preceded by any spaces.&lt;br&gt;
Write a program that prints a staircase of size n.&lt;/p&gt;
&lt;h2&gt;
  
  
  Function Description
&lt;/h2&gt;

&lt;p&gt;Complete the staircase function in the editor below.&lt;br&gt;
staircase has the following parameter(s):&lt;/p&gt;

&lt;p&gt;&lt;em&gt;int n: an integer&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Print
&lt;/h2&gt;

&lt;p&gt;Print a staircase as described above.&lt;/p&gt;
&lt;h2&gt;
  
  
  Input Format
&lt;/h2&gt;

&lt;p&gt;A single integer, , denoting the size of the staircase.&lt;/p&gt;
&lt;h2&gt;
  
  
  Output Format
&lt;/h2&gt;

&lt;p&gt;Print a staircase of size  using # symbols and spaces.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: The last line must have  spaces in it.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;
using namespace std;

int main()
{
    int n ;
    cin &amp;gt;&amp;gt;n;

    for (int i = 1; i &amp;lt;= n; i++)
    {
        for (int j = 0; j &amp;lt; n - i; j++)
        {
            cout &amp;lt;&amp;lt; " ";
        }

        for (int k = 0; k &amp;lt; i; k++)
        {
            cout &amp;lt;&amp;lt; "#";
        }
        cout &amp;lt;&amp;lt; endl;
    }

    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>hackerrank</category>
      <category>dsa</category>
      <category>patters</category>
    </item>
    <item>
      <title>Min-Max-Sum hacker rank solution</title>
      <dc:creator>Anin Arafath</dc:creator>
      <pubDate>Mon, 28 Mar 2022 05:03:41 +0000</pubDate>
      <link>https://dev.to/aninarafath6/min-max-sum-hacker-rank-solution-427h</link>
      <guid>https://dev.to/aninarafath6/min-max-sum-hacker-rank-solution-427h</guid>
      <description>&lt;p&gt;Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers.&lt;/p&gt;

&lt;p&gt;Example :-&lt;/p&gt;

&lt;p&gt;arr = [1,3,7,5,9]&lt;/p&gt;

&lt;p&gt;minimum sum is  and the maximum sum is 1+3+5+7 = 16  and the maximum sum is 3+7+5+9 =24&lt;/p&gt;

&lt;p&gt;The function prints&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;16 14&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;code :-&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void miniMaxSum(vector&amp;lt;int&amp;gt; arr) {
     long long int sum =0;int maxVal=arr[0],minVal=arr[0];


    for(int i=0;i&amp;lt;5;i++){
        sum += arr[i];
        minVal = min(minVal,arr[i]);
        maxVal = max(maxVal,arr[i]);
    }

    long long int minSum = sum - maxVal;
    long long int maxSum = sum - minVal;


    cout &amp;lt;&amp;lt; minSum &amp;lt;&amp;lt; " "&amp;lt;&amp;lt; maxSum &amp;lt;&amp;lt; endl;

}

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

&lt;/div&gt;



</description>
      <category>solution</category>
      <category>hackerrank</category>
      <category>dsa</category>
    </item>
    <item>
      <title>Diagonal Difference HackerRank solution</title>
      <dc:creator>Anin Arafath</dc:creator>
      <pubDate>Mon, 28 Mar 2022 04:57:29 +0000</pubDate>
      <link>https://dev.to/aninarafath6/diagonal-difference-3ij2</link>
      <guid>https://dev.to/aninarafath6/diagonal-difference-3ij2</guid>
      <description>&lt;p&gt;Given a square matrix, calculate the absolute difference between the sums of its diagonals.&lt;br&gt;
For example, the square matrix  is shown below:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;1  2  3 &lt;br&gt;
  4  5  6&lt;br&gt;
  9  8  9&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The left-to-right diagonal = 1 + 5 + 9 = 15 The right to left diagonal = 3 + 5 + 9 = 17, Their absolute difference is |15-17| = 2.&lt;/p&gt;

&lt;h2&gt;
  
  
  in c++
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int diagonalDifference(vector&amp;lt;vector&amp;lt;int&amp;gt;&amp;gt; arr,int n) {

    int lft=0,rit=0;

    for(int i=0;i&amp;lt;n;i++){
        lft += arr[i][i];
        rit += arr[(n-i)][(n-i)];
    }

    return abs(rit-lft);

}

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

&lt;/div&gt;



</description>
      <category>cpp</category>
      <category>proble</category>
      <category>ds</category>
    </item>
    <item>
      <title>Higher Order Functions</title>
      <dc:creator>Anin Arafath</dc:creator>
      <pubDate>Sun, 13 Feb 2022 09:24:05 +0000</pubDate>
      <link>https://dev.to/aninarafath6/higher-order-functions-3b8b</link>
      <guid>https://dev.to/aninarafath6/higher-order-functions-3b8b</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What Is Higher order function?&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;In dart programming language can accept a function as an argument, this type of functions is called higher order functions.&lt;/em&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;for example :-&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void printUser(String Function() getUser)
{
    // getting user maybe it's from api like etc.
    String user = getUser();

   // and print the user.
    print(user);
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here the PrintUser is a higher order function because &lt;code&gt;printUser&lt;/code&gt; function is accept a function named &lt;code&gt;getUser&lt;/code&gt; as an argument, that &lt;code&gt;void printUser(String Function() getUser){ }&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;The functions are first class citizens in dart programming language because, They can be assigned to a variable, passed as an argument to another function, returned from a function, stored in other Data collections, and created in any scope.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;What is callback function?&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
// this function called higher order function.
void higherOrderFunction(String Function() callbackFunction)
{

  // this function called callback function generally.
  callbackFunction();

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;A function passed as the argument of another function , this kind of function is called callback functions and which function is accepted the callback function that function is called higher order function.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>dart</category>
      <category>flutter</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Int and double</title>
      <dc:creator>Anin Arafath</dc:creator>
      <pubDate>Fri, 11 Feb 2022 13:30:20 +0000</pubDate>
      <link>https://dev.to/aninarafath6/int-and-double-1g91</link>
      <guid>https://dev.to/aninarafath6/int-and-double-1g91</guid>
      <description>&lt;p&gt;&lt;em&gt;The dart programming language is similar to c ,cpp and javascript there is some difference in syntax that's it.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Type in Dart
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;int    &amp;amp;  double&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1. Int&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Int is a numeric data type in dart.&lt;/li&gt;
&lt;li&gt;Int data type is mainly used for store integer numbers.&lt;/li&gt;
&lt;li&gt;In this data type can't hold floating numbers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;for example :-&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void main(){

// declare an integer variable.
int number = 10;

print(number); // result -&amp;gt; 10.
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the output will be 10.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;the next code block is incorrect way, we can't assign the floating value to integer datatype.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void main(){
// declare an integer variable.
// and trying to assign a floating value.
int number = 10.5;

print(number); // result -&amp;gt; error occurs.
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4hyauafmia2l96jq6f7r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4hyauafmia2l96jq6f7r.png" alt="error when assign value"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;in this case we will get an error due to we are trying to assign a floating value to integer data variable.&lt;/p&gt;

&lt;p&gt;so how we can create a floating variable ? Let's make it.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;2.double&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Double is also numeric type in dart.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This data type can hold floating values.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;also we can save integer data type but it's really happening storing value as a floating .&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;for example :-&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void main(){

// declare a floating variable.
double number = 10.4;

print(number); // result -&amp;gt; 10.4.
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the result will be 10.4 .&lt;/p&gt;

&lt;p&gt;also we can store values like integer  for example :-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void main(){

// declare a floating variable.
double number = 4;

print(number); // result -&amp;gt; 4.0.
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;in this case we declared variable as floating variable by using double datatype.&lt;/p&gt;

&lt;p&gt;Are you thinking how it can possible?&lt;/p&gt;

&lt;p&gt;don't worry about it it just storing 4.0, it's really storing as a floating value. &lt;/p&gt;

&lt;p&gt;so the result will be 4.0 .&lt;/p&gt;

</description>
      <category>dart</category>
      <category>flutter</category>
      <category>beginners</category>
      <category>datatype</category>
    </item>
    <item>
      <title>Custom Silver App bar</title>
      <dc:creator>Anin Arafath</dc:creator>
      <pubDate>Sat, 05 Feb 2022 06:59:41 +0000</pubDate>
      <link>https://dev.to/aninarafath6/custom-silver-app-bar-3o9d</link>
      <guid>https://dev.to/aninarafath6/custom-silver-app-bar-3o9d</guid>
      <description>&lt;p&gt;In normal case we use &lt;strong&gt;AppBar&lt;/strong&gt; widget to create tool bar, and when we need a special type of app-bar like WhatsApp app-bar then we need an another widget called &lt;strong&gt;SliverAppBar&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;These is simple to understand but it's not very simple, if we practice and explore more more parameters then will be simple.&lt;/p&gt;

&lt;p&gt;I have seen many questions in &lt;em&gt;stackOverflow&lt;/em&gt; and &lt;em&gt;gitHub-repos&lt;/em&gt; how we can build WhatsApp like app-bar ? &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Observation&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwbrgq0o8pruv4jxdfeuw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwbrgq0o8pruv4jxdfeuw.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First we need understand about differentiation of  WhatsApp appBar and normal appBar&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We can observe from WhatsApp there we can see a sliding behaviour on appBar.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;That sliding behaviour we can't build using normal AppBar widget .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wee need help of another widget to achieve that kind of design.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Let's build.&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';
import 'package:whatsapp/constants/app_colors.dart';
import 'package:whatsapp/views/screens/home_screen/widgets/custom_tab.dart';

class CustomAppBar extends StatelessWidget {
  const CustomAppBar({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SliverAppBar(
      toolbarHeight: 49,
      pinned: true,
      expandedHeight: 110,
      backgroundColor: AppColors.primarySwatch,
      title: const Text(
        'WhatsApp',
        style: TextStyle(
          fontWeight: FontWeight.w600,
          fontSize: 23,
        ),
      ),
      centerTitle: false,
      actions: [
        IconButton(
          splashRadius: 20,
          onPressed: () {},
          icon: const Icon(Icons.search),
        ),
        IconButton(
          splashRadius: 20,
          onPressed: () {},
          icon: const Icon(Icons.more_vert),
        ),
      ],
      bottom: const PreferredSize(
        preferredSize: Size.fromHeight(0),
        child: TabBar(
          indicatorWeight: 3,
          indicatorColor: Colors.white,
          tabs: [
            Tab(
              icon: Icon(Icons.photo_camera),
            ),
            CustomTab(name: 'chats'),
            CustomTab(name: 'status'),
            CustomTab(name: 'calls'),
          ],
        ),
      ),
    );
  }
}

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

&lt;/div&gt;



&lt;p&gt;here we are using sliver appBar.&lt;/p&gt;

&lt;p&gt;full code is available on &lt;a href="https://github.com/aninarafath6/whatsapp_clone_yt" rel="noopener noreferrer"&gt;gitHub&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;WhatsApp clone full video series &lt;a href="https://www.youtube.com/watch?v=KCbiNYHQPqM&amp;amp;list=PLYg7VCCs-_tzajBchbANFoPojQnVoNYtA" rel="noopener noreferrer"&gt;YouTube&lt;/a&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>beginners</category>
      <category>dart</category>
      <category>whatsapp</category>
    </item>
  </channel>
</rss>
