Add redesigned custom dialog (#90)

This commit is contained in:
Tommy Chow 2022-06-27 00:04:23 -04:00
parent a20c0b9b84
commit eac021d892

49
lib/widgets/dialog.dart Normal file
View file

@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
/// A custom dialog that makes the title bold, puts the actions in a column, and adds a subtle border.
class FrostyDialog extends StatelessWidget {
final String title;
final Widget content;
final List<Widget>? actions;
const FrostyDialog({
Key? key,
this.actions,
required this.title,
required this.content,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return AlertDialog(
titlePadding: const EdgeInsets.all(30.0),
contentPadding: const EdgeInsets.fromLTRB(30.0, 0.0, 30.0, 30.0),
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.deepPurpleAccent.withOpacity(0.3),
width: 3.0,
),
borderRadius: BorderRadius.circular(20.0),
),
title: Text(
title,
style: const TextStyle(fontWeight: FontWeight.bold),
),
content: SingleChildScrollView(
child: Column(children: [
content,
if (actions != null) ...[
const SizedBox(height: 20.0),
...?actions?.map(
(action) => Container(
width: double.infinity,
padding: const EdgeInsets.only(top: 10.0),
child: action,
),
),
],
]),
),
);
}
}