2020-04-24 17:34:32 +00:00
|
|
|
import 'dart:ui';
|
2020-12-14 17:54:56 +00:00
|
|
|
import 'package:cake_wallet/di.dart';
|
|
|
|
import 'package:cake_wallet/store/settings_store.dart';
|
|
|
|
import 'package:cake_wallet/themes.dart';
|
2020-04-24 17:34:32 +00:00
|
|
|
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-12-14 17:54:56 +00:00
|
|
|
Themes get currentTheme => getIt.get<SettingsStore>().currentTheme;
|
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-14 17:54:56 +00:00
|
|
|
currentTheme.isLightTheme
|
|
|
|
? Container(
|
|
|
|
width: 1,
|
|
|
|
height: 52,
|
|
|
|
color: Colors.grey[300],
|
|
|
|
)
|
|
|
|
: Offstage(),
|
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>[
|
|
|
|
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-12-14 17:54:56 +00:00
|
|
|
currentTheme.isLightTheme
|
|
|
|
? Container(
|
|
|
|
height: 1,
|
|
|
|
color: Colors.grey[300],
|
|
|
|
)
|
|
|
|
: Offstage(),
|
2020-08-25 18:12:14 +00:00
|
|
|
actionButtons(context)
|
|
|
|
],
|
|
|
|
),
|
2020-04-24 17:34:32 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|