flutter_alert 0.4.0 copy "flutter_alert: ^0.4.0" to clipboard
flutter_alert: ^0.4.0 copied to clipboard

Flutter package which shows a crossplatform alert messages on Android (Material) and iOS (Cupertino).

example/flutter_alert.dart

import 'package:flutter/material.dart';

import 'package:flutter_alert/flutter_alert.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHome(),
    );
  }
}

class MyHome extends StatelessWidget {
  void _showDialog(BuildContext context) {
    showAlert(
      context: context,
      title: "Delete file?",
      body: "Should we delete the file XYZ?",
      actions: [
        AlertAction(
          text: "Delete",
          isDestructiveAction: true,
          onPressed: () {
            // TODO
          },
        ),
      ],
      cancelable: true,
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("OK"),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => _showDialog(context),
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}
9
likes
40
pub points
82%
popularity

Publisher

unverified uploader

Flutter package which shows a crossplatform alert messages on Android (Material) and iOS (Cupertino).

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_alert