Answers for "flutter alertdialog on page load"

7

flutter alertdialog padding

titlePadding: const EdgeInsets.only(top: 24.0, left: 24.0, right: 24.0),
contentPadding: const EdgeInsets.fromLTRB(24.0, 20.0, 24.0, 24.0),
actionsPadding: const EdgeInsets.all(0.0), // Padding around the set of actions at the bottom of the dialog.
buttonPadding: const EdgeInsets.all(8.0), // The padding that surrounds each button in actions.
insetPadding: const EdgeInsets.symmetric(horizontal: 40.0, vertical: 24.0),
Posted by: Guest on August-22-2021
0

flutter show dialog on start

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"),
              ));
    }
  }
Posted by: Guest on December-23-2020

Code answers related to "Dart"

Browse Popular Code Answers by Language