s_custom_alert 0.0.1 s_custom_alert: ^0.0.1 copied to clipboard
to be able to show a custom alert box easily.
import 'package:flutter/material.dart';
import 'package:s_custom_alert/s_custom_alert.dart';
//Third commit
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'CustomAlertBox Package'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Text(
'to show custom alert box please click floating action button.'),
),
floatingActionButton: FloatingActionButton(
onPressed: () async {
await CustomAlertBox.showCustomAlertBox(
context: context,
willDisplayWidget: Container(
child: Text('My custom alert box, used from example!!'),
));
},
tooltip: 'Show Custom Alert Box',
child: Icon(Icons.message),
),
);
}
}