AboutDialog widget and Attributes

AboutDialog widget and Attributes

The AboutDialog widget in Flutter is a pre-designed dialog that displays information about an application or software. It typically includes details such as the application name, version, and other relevant information. The AboutDialog is a convenient way to present credits, licenses, and other acknowledgments to users.

Here are the primary attributes of the AboutDialog widget along with examples:

  1. applicationIcon (Widget?):

    • The icon representing the application.

      Example:

        AboutDialog(
          applicationIcon: Icon(Icons.info),
          // other attributes...
        )
      
  2. applicationName (String):

    • The name of the application.

      Example:

        AboutDialog(
          applicationName: 'My New App',
          // other attributes...
        )
      
  3. applicationVersion (String?):

    • The version number of the application.

    • Example:

        AboutDialog(
          applicationVersion: '1.0.0',
          // other attributes...
        )
      
  4. applicationLegalese (String?):

    • Additional legal or copyright information about the application.

    • Example:

        AboutDialog(
          applicationLegalese: '© 2024 oceanMtech',
          // other attributes...
        )
      
  5. children (List<Widget>):

    • Additional widgets or information to display in the dialog.

      Example:

        AboutDialog(
          children: [
            Text('Developer: Vinit Mepani'),
            Text('Email: vinitmepani2712@gmail.com'),
          ],
          // other attributes...
        )
      

Full Example:

import 'package:flutter/material.dart';

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

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

  void showCustomAboutDialog(BuildContext context) {
    showDialog(
      context: context,
      builder: (BuildContext context) {
        return Builder(
          builder: (BuildContext context) {
            return AlertDialog(
              title: Text('About My New App'),
              content: Column(
                children: [
                  Icon(Icons.info, size: 60),
                  SizedBox(height: 16),
                  Text('Version: 1.0.0'),
                  Text('© 2024 OceanMtech'),
                  SizedBox(height: 16),
                  Text('Developer: Vinit Mepani'),
                  Text('Email: vinitmepani2712@gmail.com'),
                ],
              ),
              actions: [
                ElevatedButton(
                  onPressed: () {
                    Navigator.of(context).pop();
                  },
                  child: Text('Close'),
                ),
              ],
            );
          },
        );
      },
    );
  }
}

In this example, a Flutter application with a button is created. When the button is pressed, it triggers the display of an AboutDialog with various attributes such as the application icon, name, version, legal information, and additional custom widgets. Adjust the attributes and content according to your application's details and requirements.

Did you find this article valuable?

Support Vinit Mepani (Flutter Developer) by becoming a sponsor. Any amount is appreciated!