Search
 
SCRIPT & CODE EXAMPLE
 

DART

message yes or not in dart

showAlertDialog(BuildContext context) {

  // set up the buttons
  Widget cancelButton = FlatButton(
    child: Text("Cancel"),
    onPressed:  () {},
  );
  Widget continueButton = FlatButton(
    child: Text("Continue"),
    onPressed:  () {},
  );

  // set up the AlertDialog
  AlertDialog alert = AlertDialog(
    title: Text("AlertDialog"),
    content: Text("Would you like to continue learning how to use Flutter alerts?"),
    actions: [
      cancelButton,
      continueButton,
    ],
  );

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

message yes or not in dart

import 'package:flutter/material.dart';

class BaseAlertDialog extends StatelessWidget {

  //When creating please recheck 'context' if there is an error!

  Color _color = Color.fromARGB(220, 117, 218 ,255);

  String _title;
  String _content;
  String _yes;
  String _no;
  Function _yesOnPressed;
  Function _noOnPressed;

  BaseAlertDialog({String title, String content, Function yesOnPressed, Function noOnPressed, String yes = "Yes", String no = "No"}){
    this._title = title;
    this._content = content;
    this._yesOnPressed = yesOnPressed;
    this._noOnPressed = noOnPressed;
    this._yes = yes;
    this._no = no;
  }

  @override
  Widget build(BuildContext context) {
    return AlertDialog(
      title: new Text(this._title),
      content: new Text(this._content),
      backgroundColor: this._color,
      shape:
          RoundedRectangleBorder(borderRadius: new BorderRadius.circular(15)),
      actions: <Widget>[
        new FlatButton(
          child: new Text(this._yes),
          textColor: Colors.greenAccent,
          onPressed: () {
            this._yesOnPressed();
          },
        ),
        new FlatButton(
          child: Text(this._no),
          textColor: Colors.redAccent,
          onPressed: () {
            this._noOnPressed();
          },
        ),
      ],
    );
  }
}
Comment

PREVIOUS NEXT
Code Example
Dart :: flutter image load 
Dart :: flutter auto size text 
Dart :: flutter compute 
Dart :: scroll with mouse in flutter 
Dart :: dart function 
Dart :: flutter cupertinoapp 
Dart :: how to make an empty splash screen in flutter 
Dart :: filter duplicates in dart 
Dart :: text underline flutter 
Dart :: flutter delete directory 
Dart :: Error: java.io.IOException: No such file or directory in android 11 
Dart :: add fullscreen modal on a page in flutter app 
Dart :: object dart 
Dart :: list dart 
Dart :: convert datetime to TZDateTimeflutter 
Dart :: dart callback function 
Dart :: string null dart 
Dart :: how to hide the keyboard in flutter 
Dart :: speedometer in flutter 
Dart :: How to i convert this python code to dart? 
Dart :: flutter remove item from list 
Dart :: container vs card flutter 
Dart :: how to center widgets in using scrollview flutter 
Dart :: dart destructor 
Dart :: flutter center title ignore button 
Swift :: format decimal place swift 
Swift :: swift stackview content inset 
Swift :: unrecognized font family Helvetica-Regular 
Swift :: textfield style swiftui own 
Swift :: swift swipe gesture 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =