112 lines
3.8 KiB
Dart
112 lines
3.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
|
|
///兑换码弹窗
|
|
class ExchangeDialog extends StatefulWidget {
|
|
final Function onTap;
|
|
|
|
const ExchangeDialog({super.key, required this.onTap});
|
|
|
|
@override
|
|
State<ExchangeDialog> createState() => _ExchangeDialogState();
|
|
}
|
|
|
|
class _ExchangeDialogState extends State<ExchangeDialog> {
|
|
final TextEditingController _textController = TextEditingController();
|
|
String redemptionCode = "";
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Material(
|
|
type: MaterialType.transparency, //透明类型
|
|
color: Color(0x1A000000),
|
|
child: Center(
|
|
child: Container(
|
|
width: 296,
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF202530),
|
|
borderRadius: BorderRadius.circular(11),
|
|
),
|
|
child: Stack(
|
|
children: [
|
|
Positioned(
|
|
right: 11,
|
|
top: 11,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
},
|
|
child: Image(
|
|
width: 16,
|
|
height: 16,
|
|
image: AssetImage('assets/images/ic_cross.png'),
|
|
),
|
|
),
|
|
),
|
|
Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Container(
|
|
alignment: Alignment.center,
|
|
margin: EdgeInsets.only(top: 29),
|
|
child: Text(
|
|
"请输入礼包码兑换奖励",
|
|
style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)),
|
|
),
|
|
),
|
|
Container(
|
|
width: 220,
|
|
height: 34,
|
|
alignment: Alignment.center,
|
|
margin: EdgeInsets.only(top: 29),
|
|
decoration: const BoxDecoration(
|
|
color: Color(0xFF111319),
|
|
borderRadius: BorderRadius.all(
|
|
Radius.circular(11),
|
|
)),
|
|
child: TextField(
|
|
textAlign: TextAlign.center,
|
|
controller: _textController,
|
|
cursorColor: Color(0xFF074CE7),
|
|
style: TextStyle(fontSize: 11, color: Colors.white),
|
|
decoration: InputDecoration(
|
|
border: InputBorder.none,
|
|
hintText: '请输入内容',
|
|
hintStyle: TextStyle(fontSize: 11, color: Color(0xFF44474F)),
|
|
),
|
|
),
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
if (_textController.text == "") {
|
|
EasyLoading.showToast("请输入兑换码");
|
|
return;
|
|
}
|
|
// Navigator.pop(context);
|
|
widget.onTap(_textController.text);
|
|
},
|
|
child: Container(
|
|
width: 102,
|
|
height: 32,
|
|
alignment: Alignment.center,
|
|
margin: EdgeInsets.only(top: 34, bottom: 17),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF074CE7),
|
|
borderRadius: BorderRadius.all(Radius.circular(18)),
|
|
),
|
|
child: Text(
|
|
"兑换",
|
|
style: TextStyle(fontSize: 13, color: Colors.white),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|