2020-04-24 17:34:32 +00:00
|
|
|
import 'dart:ui';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:cake_wallet/palette.dart';
|
|
|
|
|
|
|
|
class BaseAlertDialog extends StatelessWidget {
|
|
|
|
String get titleText => '';
|
|
|
|
String get contentText => '';
|
|
|
|
String get leftActionButtonText => '';
|
|
|
|
String get rightActionButtonText => '';
|
|
|
|
VoidCallback get actionLeft => () {};
|
|
|
|
VoidCallback get actionRight => () {};
|
2020-04-27 17:31:39 +00:00
|
|
|
bool get barrierDismissible => true;
|
2020-04-24 17:34:32 +00:00
|
|
|
|
|
|
|
Widget title(BuildContext context) {
|
|
|
|
return Text(
|
|
|
|
titleText,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20,
|
2020-08-25 18:12:14 +00:00
|
|
|
fontFamily: 'Poppins',
|
2020-04-24 17:34:32 +00:00
|
|
|
fontWeight: FontWeight.w600,
|
2020-05-29 15:10:11 +00:00
|
|
|
color: Theme.of(context).primaryTextTheme.title.color,
|
2020-04-24 17:34:32 +00:00
|
|
|
decoration: TextDecoration.none,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget content(BuildContext context) {
|
|
|
|
return Text(
|
|
|
|
contentText,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
2020-08-25 18:12:14 +00:00
|
|
|
fontFamily: 'Poppins',
|
2020-05-29 15:10:11 +00:00
|
|
|
color: Theme.of(context).primaryTextTheme.title.color,
|
2020-04-24 17:34:32 +00:00
|
|
|
decoration: TextDecoration.none,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget actionButtons(BuildContext context) {
|
2020-08-25 18:12:14 +00:00
|
|
|
return Row(
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
children: <Widget>[
|
|
|
|
Flexible(
|
2020-04-24 17:34:32 +00:00
|
|
|
child: Container(
|
2020-08-25 18:12:14 +00:00
|
|
|
height: 52,
|
2020-08-31 16:44:48 +00:00
|
|
|
padding: EdgeInsets.only(left: 6, right: 6),
|
2020-08-25 18:12:14 +00:00
|
|
|
color: Palette.blueCraiola,
|
2020-04-24 17:34:32 +00:00
|
|
|
child: ButtonTheme(
|
|
|
|
minWidth: double.infinity,
|
|
|
|
child: FlatButton(
|
2020-08-25 18:12:14 +00:00
|
|
|
onPressed: actionLeft,
|
|
|
|
highlightColor: Colors.transparent,
|
|
|
|
splashColor: Colors.transparent,
|
|
|
|
child: Text(
|
|
|
|
leftActionButtonText,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 15,
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
color: Colors.white,
|
|
|
|
decoration: TextDecoration.none,
|
|
|
|
),
|
|
|
|
)),
|
2020-04-24 17:34:32 +00:00
|
|
|
),
|
|
|
|
)
|
2020-08-25 18:12:14 +00:00
|
|
|
),
|
|
|
|
Flexible(
|
2020-04-24 17:34:32 +00:00
|
|
|
child: Container(
|
2020-08-25 18:12:14 +00:00
|
|
|
height: 52,
|
2020-08-31 16:44:48 +00:00
|
|
|
padding: EdgeInsets.only(left: 6, right: 6),
|
2020-08-25 18:12:14 +00:00
|
|
|
color: Palette.alizarinRed,
|
2020-04-24 17:34:32 +00:00
|
|
|
child: ButtonTheme(
|
|
|
|
minWidth: double.infinity,
|
|
|
|
child: FlatButton(
|
|
|
|
onPressed: actionRight,
|
|
|
|
highlightColor: Colors.transparent,
|
|
|
|
splashColor: Colors.transparent,
|
|
|
|
child: Text(
|
|
|
|
rightActionButtonText,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 15,
|
2020-08-25 18:12:14 +00:00
|
|
|
fontFamily: 'Poppins',
|
2020-04-24 17:34:32 +00:00
|
|
|
fontWeight: FontWeight.w600,
|
2020-08-25 18:12:14 +00:00
|
|
|
color: Colors.white,
|
2020-04-24 17:34:32 +00:00
|
|
|
decoration: TextDecoration.none,
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
)
|
2020-08-25 18:12:14 +00:00
|
|
|
)
|
|
|
|
],
|
2020-04-24 17:34:32 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return GestureDetector(
|
2020-04-27 17:31:39 +00:00
|
|
|
onTap: () => barrierDismissible
|
|
|
|
? Navigator.of(context).pop()
|
|
|
|
: null,
|
2020-04-24 17:34:32 +00:00
|
|
|
child: Container(
|
|
|
|
color: Colors.transparent,
|
|
|
|
child: BackdropFilter(
|
|
|
|
filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0),
|
|
|
|
child: Container(
|
2020-05-29 15:10:11 +00:00
|
|
|
decoration: BoxDecoration(color: PaletteDark.darkNightBlue.withOpacity(0.75)),
|
2020-04-24 17:34:32 +00:00
|
|
|
child: Center(
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () => null,
|
2020-08-25 18:12:14 +00:00
|
|
|
child: ClipRRect(
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(30)),
|
|
|
|
child: Container(
|
|
|
|
width: 300,
|
|
|
|
color: Theme.of(context).accentTextTheme.title.decorationColor,
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: <Widget>[
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.fromLTRB(24, 32, 24, 32),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: <Widget>[
|
|
|
|
title(context),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(top: 8),
|
|
|
|
child: content(context),
|
|
|
|
)
|
|
|
|
],
|
2020-04-24 17:34:32 +00:00
|
|
|
),
|
|
|
|
),
|
2020-08-25 18:12:14 +00:00
|
|
|
actionButtons(context)
|
|
|
|
],
|
|
|
|
),
|
2020-04-24 17:34:32 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|