212 lines
6.7 KiB
Dart
212 lines
6.7 KiB
Dart
import 'package:aitrainer_app/util/trans.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
// ignore: must_be_immutable
|
|
class DialogCommon extends StatefulWidget {
|
|
final String title, descriptions, text;
|
|
final VoidCallback onTap;
|
|
final VoidCallback? onCancel;
|
|
String? description2, description3;
|
|
final Image? img;
|
|
|
|
DialogCommon(
|
|
{Key? key,
|
|
required this.title,
|
|
required this.descriptions,
|
|
this.description2,
|
|
this.description3,
|
|
required this.text,
|
|
this.img,
|
|
required this.onTap,
|
|
required this.onCancel})
|
|
: super(key: key) {
|
|
description2 = description2 ?? "";
|
|
description3 = description3 ?? "";
|
|
}
|
|
|
|
@override
|
|
_DialogPremiumState createState() {
|
|
return _DialogPremiumState();
|
|
}
|
|
}
|
|
|
|
class _DialogPremiumState extends State<DialogCommon> with Trans {
|
|
bool isStart = true;
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
setContext(context);
|
|
return Dialog(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(31),
|
|
),
|
|
elevation: 0,
|
|
backgroundColor: Colors.transparent,
|
|
child: SingleChildScrollView(padding: EdgeInsets.only(bottom: 30), child: contentBox(context)),
|
|
);
|
|
}
|
|
|
|
contentBox(context) {
|
|
return Stack(alignment: AlignmentDirectional.topStart, children: [
|
|
Stack(
|
|
children: <Widget>[
|
|
Container(
|
|
padding: EdgeInsets.only(left: 20, top: 24, right: 20, bottom: 30),
|
|
margin: EdgeInsets.only(top: 30),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(24),
|
|
boxShadow: [BoxShadow(color: Colors.black, offset: Offset(0, 10), blurRadius: 10)],
|
|
image: DecorationImage(
|
|
image: AssetImage('asset/image/WT_black_G_background.jpg'),
|
|
fit: BoxFit.cover,
|
|
alignment: Alignment.center,
|
|
),
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: <Widget>[
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
Stack(
|
|
alignment: AlignmentDirectional.topEnd,
|
|
children: [
|
|
Text(
|
|
widget.title + " ",
|
|
textAlign: TextAlign.center,
|
|
style: GoogleFonts.archivoBlack(
|
|
fontSize: 20,
|
|
color: Colors.yellow[400],
|
|
shadows: <Shadow>[
|
|
Shadow(
|
|
offset: Offset(5.0, 5.0),
|
|
blurRadius: 12.0,
|
|
color: Colors.black54,
|
|
),
|
|
Shadow(
|
|
offset: Offset(-3.0, 3.0),
|
|
blurRadius: 12.0,
|
|
color: Colors.black54,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 35,
|
|
),
|
|
Text(
|
|
widget.descriptions,
|
|
style: GoogleFonts.inter(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
shadows: <Shadow>[
|
|
Shadow(
|
|
offset: Offset(5.0, 5.0),
|
|
blurRadius: 12.0,
|
|
color: Colors.black54,
|
|
),
|
|
Shadow(
|
|
offset: Offset(-3.0, 3.0),
|
|
blurRadius: 12.0,
|
|
color: Colors.black54,
|
|
),
|
|
],
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
SizedBox(
|
|
height: 15,
|
|
),
|
|
Text(
|
|
widget.description2!,
|
|
style: GoogleFonts.inter(
|
|
fontSize: 16,
|
|
color: Colors.white,
|
|
shadows: <Shadow>[
|
|
Shadow(
|
|
offset: Offset(5.0, 5.0),
|
|
blurRadius: 12.0,
|
|
color: Colors.black54,
|
|
),
|
|
Shadow(
|
|
offset: Offset(-3.0, 3.0),
|
|
blurRadius: 12.0,
|
|
color: Colors.black54,
|
|
),
|
|
],
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
SizedBox(
|
|
height: 15,
|
|
),
|
|
Text(
|
|
widget.description3!,
|
|
style: GoogleFonts.inter(
|
|
fontSize: 16,
|
|
color: Colors.white,
|
|
shadows: <Shadow>[
|
|
Shadow(
|
|
offset: Offset(5.0, 5.0),
|
|
blurRadius: 12.0,
|
|
color: Colors.black54,
|
|
),
|
|
Shadow(
|
|
offset: Offset(-3.0, 3.0),
|
|
blurRadius: 12.0,
|
|
color: Colors.black54,
|
|
),
|
|
],
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
SizedBox(
|
|
height: 52,
|
|
),
|
|
Align(
|
|
alignment: Alignment.center,
|
|
child: GestureDetector(
|
|
onTap: widget.onTap,
|
|
child: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
Image.asset('asset/icon/gomb_orange_c.png', width: 100, height: 45),
|
|
Text(
|
|
t("OK"),
|
|
style: TextStyle(fontSize: 16, color: Colors.white),
|
|
),
|
|
],
|
|
))),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
if (widget.onCancel == null) {
|
|
Navigator.of(context).pop();
|
|
} else {
|
|
widget.onCancel!();
|
|
}
|
|
},
|
|
child: CircleAvatar(
|
|
backgroundColor: Colors.transparent,
|
|
radius: 28,
|
|
child: Text(
|
|
"X",
|
|
style: GoogleFonts.archivoBlack(fontSize: 32, color: Colors.white54),
|
|
),
|
|
)),
|
|
]);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
}
|
|
}
|