asalert 0.0.4 copy "asalert: ^0.0.4" to clipboard
asalert: ^0.0.4 copied to clipboard

asalert is delightful package to display platform based alert in flutter app..

example/lib/main.dart

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

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  final _scaffoldKey = GlobalKey<ScaffoldState>();

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            FlatButton(
              highlightColor: Colors.transparent,
              child: Text(
                "Click me",
              ),
              onPressed: () {
                showAlertWithOkayAction(context, "ASAlert", "Hey.... Welcome ", closeDialogue, btnTitle: "Dismiss");
              },
            ),
            FlatButton(
              highlightColor: Colors.transparent,
              child: Text(
                "Logout",
              ),
              onPressed: () {
                showOkayAndCloseAlertWithOkayAction(context, onPressedOk, "Logout", "Are you sure you want to logout the app?");
              },
            )
          ],
        ),
      ),
    );
  }

  onPressedOk() {
    closeDialogue();
    showAlertWithOkayAction(context, "Alert", "You have successfully logged out.", closeDialogue);
  }

  closeDialogue() {
    Navigator.of(context, rootNavigator: true).pop('dialog');
  }
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

void main() {
  runApp(MyApp());
}
0
likes
30
pub points
0%
popularity

Publisher

verified publisheratharvasystem.com

asalert is delightful package to display platform based alert in flutter app..

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on asalert