tsacdop-podcast-app-android/lib/util/general_dialog.dart

66 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'extension_helper.dart';
Future generalDialog(BuildContext context,
{Widget title, Widget content, List<Widget> actions}) async =>
await showGeneralDialog(
context: context,
barrierDismissible: true,
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
barrierColor: Colors.black54,
transitionDuration: const Duration(milliseconds: 200),
pageBuilder: (context, animaiton, secondaryAnimation) =>
AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(
statusBarIconBrightness: Brightness.light,
systemNavigationBarColor: context.brightness == Brightness.light
? Color.fromRGBO(113, 113, 113, 1)
: Color.fromRGBO(15, 15, 15, 1),
),
child: AlertDialog(
elevation: 2,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
titlePadding: EdgeInsets.all(20),
title: SizedBox(width: context.width - 120, child: title),
content: content,
contentPadding: EdgeInsets.fromLTRB(20, 0, 20, 0),
actions: actions),
),
);
Future generalSheet(BuildContext context, {Widget child, String title}) async =>
await showModalBottomSheet(
isScrollControlled: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0)),
),
elevation: 2,
context: context,
builder: (context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.only(top: 10.0, bottom: 2.0),
child: Container(
height: 4,
width: 25,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2.0),
color: context.primaryColorDark),
),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 6.0),
child: Text(title, style: context.textTheme.headline6),
),
Divider(height: 1),
child,
],
);
});