Flutter Animated Container, Elevated Button, SizeBox Widget



In this tutorial, you can easily learn about Flutter Animated Container Widget, Elevated Button, and SizeBox Widget.

Elevated Button Widget Example:

 ElevatedButton(
              onPressed: () {
                setState(() {
                  clicked =
                      !clicked; // when user clicked here bool value return false ...
                });
              },
              child: const Text("Click Me")),

When you need free space you can use the height or width property in SizeBox Widget.

SizeBox Widget Example:

 SizedBox(
            height: 10,
          ),

Flutter Animated Container Widget

Flutter Animated Container

Flutter Animated Container widget Source Code:

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  // here already create bool value ... ok
  bool clicked = true;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
          //Hey welcome to my channel ...
          // here already create a scaffold widget .... also center and column ..
          // column widget main Axisalignment CENTER ... ok now start our new topic....
          // Now we create a elevant button then container then Animated container let's started......
          ElevatedButton(
              onPressed: () {
                setState(() {
                  clicked =
                      !clicked; // when user clicked here bool value return false ...
                });
              },
              child: const Text("Click Me")),
          // here need some space ... now we use sizebox widget ...
          SizedBox(
            height: 10,
          ),
          AnimatedContainer(
            // now when user click clickme button then change Container value ... height, width and color ...
            height: ((clicked == false) ? 400 : 200),
            width: ((clicked == false) ? 200 : 400),
            // already workign button next change also color ....
            color: ((clicked == false) ? Colors.amber : Colors.green),
            // it is tool fast if we add animation here that way maybe more amazing ......so
            // animated it .... ok
            duration: const Duration(seconds: 2),
            // you can also add here BOX Decoration widget then watch our BOX decoration widget tutorial ...
          // IF you link this tutorial please SUBSCRIBE .... Thank YOu........Code LInk in the description ...
          )
        ]),
      ),
    );
  }
}
  • Boost WooCommerce Security: Set Up OTP Login in WordPress
    Passwords, while essential for security, can be vulnerable to hacking and breaches. To add an extra layer of protection for your WooCommerce store, consider implementing an OTP (One-Time Password) login. This guide walks you through the process of setting up an OTP login in WordPress for enhanced security. Why Use OTP Login? Enhanced Security: OTPs …

    Read more …

  • How to Create Woocommerce Flutter App for WordPress free
    Absolutely! Let’s break down how to create a WooCommerce Flutter app for your WordPress store. Here’s a comprehensive outline of the process and essential considerations: 1. Setup Your Development Environment 2. Project Structure 3. Dependencies 4. Core Functionality 5. User Interface (UI) and User Experience 6. Additional Features (Optional) Example Code Snippet (Fetching Products) Important …

    Read more …

  • How to Add a Link to Your Facebook Story in 2024
    Facebook Stories have become an integral part of our social media experience, allowing us to share moments and updates with our friends and followers. But did you know that you can also add links to your Facebook Stories? Adding a link to your story can be a powerful way to drive traffic to your website, …

    Read more …

  • Troubleshooting “Failed to download Laravel from dist” Error
    If you encounter the “Failed to download Laravel from dist” error while working with Laravel 10, it is likely due to the absence of the zip extension and unzip/7z commands on your system. This error prevents the successful download of Laravel from the distribution (dist) repository. What causes this error? The error occurs when the …

    Read more …

  • Solutions for “The file is too large for the destination file system” Error on Pendrive
    If you have ever encountered the frustrating error message “The file is too large for the destination file system” when trying to transfer files to your pendrive, don’t worry! There are a few solutions you can try to resolve this issue. 1. Format the Pendrive: One of the easiest ways to fix this error is …

    Read more …

Leave a Comment