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 => '';
|
2020-12-29 18:48:57 +00:00
|
|
|
bool get isDividerExists => false;
|
2020-04-24 17:34:32 +00:00
|
|
|
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-11-11 15:55:18 +00:00
|
|
|
fontFamily: 'Lato',
|
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-09-04 16:32:51 +00:00
|
|
|
fontWeight: FontWeight.normal,
|
2020-11-11 15:55:18 +00:00
|
|
|
fontFamily: 'Lato',
|
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-09-09 19:12:49 +00:00
|
|
|
color: Theme.of(context).accentTextTheme.body2.decorationColor,
|
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,
|
2020-11-11 15:55:18 +00:00
|
|
|
fontFamily: 'Lato',
|
2020-08-25 18:12:14 +00:00
|
|
|
fontWeight: FontWeight.w600,
|
2020-12-14 17:54:56 +00:00
|
|
|
color: Theme.of(context).primaryTextTheme.body2
|
|
|
|
.backgroundColor,
|
2020-08-25 18:12:14 +00:00
|
|
|
decoration: TextDecoration.none,
|
|
|
|
),
|
|
|
|
)),
|
2020-04-24 17:34:32 +00:00
|
|
|
),
|
|
|
|
)
|
2020-08-25 18:12:14 +00:00
|
|
|
),
|
2020-12-15 19:30:16 +00:00
|
|
|
Container(
|
2020-12-14 17:54:56 +00:00
|
|
|
width: 1,
|
|
|
|
height: 52,
|
2020-12-15 19:30:16 +00:00
|
|
|
color: Theme.of(context).dividerColor,
|
|
|
|
),
|
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-12-14 17:54:56 +00:00
|
|
|
color: Theme.of(context).accentTextTheme.body1.backgroundColor,
|
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-11-11 15:55:18 +00:00
|
|
|
fontFamily: 'Lato',
|
2020-04-24 17:34:32 +00:00
|
|
|
fontWeight: FontWeight.w600,
|
2020-12-14 17:54:56 +00:00
|
|
|
color: Theme.of(context).primaryTextTheme.body1
|
|
|
|
.backgroundColor,
|
2020-04-24 17:34:32 +00:00
|
|
|
decoration: TextDecoration.none,
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
)
|
2020-09-08 17:21:09 +00:00
|
|
|
),
|
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>[
|
2020-12-29 18:48:57 +00:00
|
|
|
Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: <Widget>[
|
|
|
|
Padding(
|
2021-01-12 11:14:28 +00:00
|
|
|
padding: EdgeInsets.fromLTRB(24, 20, 24, 0),
|
2020-12-29 18:48:57 +00:00
|
|
|
child: title(context),
|
|
|
|
),
|
|
|
|
isDividerExists
|
2020-12-30 14:54:55 +00:00
|
|
|
? Padding(
|
|
|
|
padding: EdgeInsets.only(top: 16, bottom: 8),
|
|
|
|
child: Container(
|
|
|
|
height: 1,
|
|
|
|
color: Theme.of(context).dividerColor,
|
|
|
|
),
|
2020-12-29 18:48:57 +00:00
|
|
|
)
|
|
|
|
: Offstage(),
|
|
|
|
Padding(
|
2020-12-30 14:54:55 +00:00
|
|
|
padding: EdgeInsets.fromLTRB(24, 8, 24, 32),
|
2020-12-29 18:48:57 +00:00
|
|
|
child: content(context),
|
|
|
|
)
|
|
|
|
],
|
2020-04-24 17:34:32 +00:00
|
|
|
),
|
2020-12-15 19:30:16 +00:00
|
|
|
Container(
|
2020-12-14 17:54:56 +00:00
|
|
|
height: 1,
|
2020-12-15 19:30:16 +00:00
|
|
|
color: Theme.of(context).dividerColor,
|
|
|
|
),
|
2020-08-25 18:12:14 +00:00
|
|
|
actionButtons(context)
|
|
|
|
],
|
|
|
|
),
|
2020-04-24 17:34:32 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|