import 'package:flutter/material.dart'; import '../generated/l10n.dart'; ///删除图片提示 class DeleteImg extends StatefulWidget { Function onTap; DeleteImg({required this.onTap}); @override State createState() => _DeleteImgState(); } class _DeleteImgState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; final h260 = size.width / 1.3846153846153; //120 return Material( type: MaterialType.transparency, //透明类型 color: const Color(0x00000000), child: Container( alignment: Alignment.center, child: Container( width: double.infinity, margin: EdgeInsets.only(left: 16, right: 16), decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(13))), child: Column( mainAxisSize: MainAxisSize.min, children: [ Container( margin: EdgeInsets.only(top: 27), child: Text( S.of(context).Tip, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600), ), ), Container( margin: EdgeInsets.only(top: 27), child: Text( S.of(context).Are_you_sure, textAlign: TextAlign.center, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600), ), ), Container( margin: EdgeInsets.only(top: 38, left: 23, right: 23, bottom: 36), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ GestureDetector( onTap: () { // widget.onTap(0); Navigator.pop(context); }, child: Container( width: 132, height: 37, alignment: Alignment.center, decoration: BoxDecoration( color: Color(0xFFEEE3FF), borderRadius: BorderRadius.all(Radius.circular(7)), ), child: Text( S.of(context).Cancel, style: TextStyle(color: Color(0xFF8841FF)), ), ), ), GestureDetector( onTap: () { Navigator.pop(context); widget.onTap(1); }, child: Container( width: 132, height: 37, alignment: Alignment.center, decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.centerLeft, //渐变开始于上面的中间开始 end: Alignment.centerRight, //渐变结束于下面的中间 colors: [Color(0xFF843FFF), Color(0xFFE975FF)]), borderRadius: BorderRadius.all(Radius.circular(7)), ), child: Text( S.of(context).Sure, style: TextStyle(color: Colors.white), ), ), ), ], ), ) ], ), ), ), ); } }