Search
 
SCRIPT & CODE EXAMPLE
 

DART

flutter alertdialog

AlertDialog(
          title: const Text('AlertDialog Title'),
          content: const Text('this is a demo alert diolog'),
          actions: <Widget>[
            TextButton(
              child: const Text('Approve'),
              onPressed: () { 
              	Navigator.of(context).pop();
              },
            ),
          ],
        );
Comment

flutter custom alert dialog

//custom_alert_dialog.dart

import 'package:flutter/material.dart';

class CustomAlertDialog extends StatefulWidget {
  const CustomAlertDialog({
    Key? key,
    required this.title,
    required this.description,
  }) : super(key: key);

  final String title, description;

  @override
  _CustomAlertDialogState createState() => _CustomAlertDialogState();
}

class _CustomAlertDialogState extends State<CustomAlertDialog> {
  @override
  Widget build(BuildContext context) {
    return Dialog(
      elevation: 0,
      backgroundColor: Color(0xffffffff),
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(15.0),
      ),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          SizedBox(height: 15),
          Text(
            "${widget.title}",
            style: TextStyle(
              fontSize: 18.0,
              fontWeight: FontWeight.bold,
            ),
          ),
          SizedBox(height: 15),
          Text("${widget.description}"),
          SizedBox(height: 20),
          Divider(
            height: 1,
          ),
          Container(
            width: MediaQuery.of(context).size.width,
            height: 50,
            child: InkWell(
              highlightColor: Colors.grey[200],
              onTap: () {
                //do somethig
              },
              child: Center(
                child: Text(
                  "Continue",
                  style: TextStyle(
                    fontSize: 18.0,
                    color: Theme.of(context).primaryColor,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
            ),
          ),
          Divider(
            height: 1,
          ),
          Container(
            width: MediaQuery.of(context).size.width,
            height: 50,
            child: InkWell(
              borderRadius: BorderRadius.only(
                bottomLeft: Radius.circular(15.0),
                bottomRight: Radius.circular(15.0),
              ),
              highlightColor: Colors.grey[200],
              onTap: () {
                Navigator.of(context).pop();
              },
              child: Center(
                child: Text(
                  "Cancel",
                  style: TextStyle(
                    fontSize: 16.0,
                    fontWeight: FontWeight.normal,
                  ),
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
Comment

alertdialog flutter

showAlertDialog(BuildContext context) {

  // set up the button
  Widget okButton = FlatButton(
    child: Text("OK"),
    onPressed: () { },
  );

  // set up the AlertDialog
  AlertDialog alert = AlertDialog(
    title: Text("My title"),
    content: Text("This is my message."),
    actions: [
      okButton,
    ],
  );

  // show the dialog
  showDialog(
    context: context,
    builder: (BuildContext context) {
      return alert;
    },
  );
}
Comment

alertdialogFlutter

showDialog(
  context: context,
  builder: (BuildContext context) {
    return AlertDialog(
      title: new Text("Alert!!"),
      content: new Text("You are awesome!"),
      actions: <Widget>[
        new FlatButton(
          child: new Text("OK"),
          onPressed: () {
            Navigator.of(context).pop();
          },
        ),
      ],
    );
  },
);
Comment

alertdialog shape flutter

  shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.all(Radius.circular(32.0))),
Comment

flutter alert dialog shape

shape: CircleBorder(),
shape: RoundedRectangleBorder(),
shape: ContinuousRectangleBorder(),
shape: BeveledRectangleBorder(),
Comment

flexible alert dialog flutter

AlertDialog(
  content: ListView(
    shrinkWrap: true,
    children: [...],
  ),
)
Comment

flexible alert dialog flutter

AlertDialog(
  content: SingleChildScrollView( 
    child: Column(
      children: [...],
    ),
  ),
)
Comment

display alert dialog automatically in flutter when app opens

import 'dart:async';
  import 'package:flutter/material.dart';

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

  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
          title: 'Trial',
          home: Scaffold(
              appBar: AppBar(title: Text('List scroll')), body: new MyHome()));
    }
  }

  class MyHome extends StatelessWidget { // Wrapper Widget
    @override
    Widget build(BuildContext context) {
      Future.delayed(Duration.zero, () => showAlert(context));
      return Container(
        child: Text("Hello world"),
      );
    }

    void showAlert(BuildContext context) {
      showDialog(
          context: context,
          builder: (context) => AlertDialog(
                content: Text("hi"),
              ));
    }
  }
Comment

PREVIOUS NEXT
Code Example
Dart :: flutter tooltip 
Dart :: dart to int 
Dart :: fluter check that date is greater than another date 
Dart :: how to do type casting in dart for string 
Dart :: flutter localstorage clear 
Dart :: Send HTTP Get request in Flutter or Dart 
Dart :: srring reverse dart 
Dart :: flutter overflow 
Dart :: flutter define type 
Dart :: flutter open null safety 
Dart :: how to put two trailing icons in list tile flutter 
Dart :: get the type of an object dart 
Dart :: flutter copy 
Dart :: alternate of string class in dart, stringBuffer dart, string buffer dart, string buffer,stringbuffer,stringBuffer 
Dart :: string to int in dart, string to double in dart, int to string in dart 
Dart :: flutter color 
Dart :: flutter bool variable 
Dart :: flutter logo flutter 
Dart :: dart async stream 
Dart :: path dart 
Dart :: search functionality dart 
Dart :: flutter cachImage 
Dart :: bloc to bloc communication in flutter 
Dart :: Single document from firestore to a dart object 
Dart :: a function body must be provided. try adding a function body. flutter 
Dart :: string to int in flutter 
Swift :: swift self.present full screen 
Swift :: swift convert dictionary to json 
Swift :: remove checkmark when selecting the cell again swift 5 
Swift :: swiftui navigation link with button 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =