customalert 0.0.2 customalert: ^0.0.2 copied to clipboard
Custom alert can show customizable and flexible alerts
import 'package:flutter/material.dart';
import 'package:customalert/custom_alert.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Custom alert test',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: CustomAlertTest());
}
}
class CustomAlertTest extends StatefulWidget {
CustomAlertTest({Key key}) : super(key: key);
@override
_CustomAlertTestState createState() => _CustomAlertTestState();
}
class _CustomAlertTestState extends State<CustomAlertTest> {
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: () async {
await CustomAlert.showCustomAlert(
context: context,
title: "Hello",
willDisplayWidget: Center(
child: Text("Content Here!"),
),
borderRadius: 10.0,
);
},
tooltip: 'Show Custom Alert Box',
child: Icon(Icons.message),
),
body: Container(
child: Center(
child: Text('Custom Alert Test'),
),
),
);
}
}