import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../translations/trans_lib.dart'; class ShowTFView extends StatelessWidget { String? title; String? tipTitle; TextEditingController? controller; Function()? sureClick; Function()? cancelClick; ShowTFView( {Key? key, this.title, this.tipTitle, this.controller, this.sureClick, this.cancelClick}) : super(key: key); @override Widget build(BuildContext context) { return Card( color: const Color(0x00FFFFFF), child: CupertinoAlertDialog( title: Text(title!), content: Column( children: [ const SizedBox( height: 10, ), Container( height: 50.h, // color: Colors.white, // padding: EdgeInsets.only(left:20.w, right: 110.w), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(15.w)), child: TextField( //输入框一行 maxLines: 1, controller: controller, autofocus: false, decoration: InputDecoration( contentPadding: const EdgeInsets.only(left: 5, top: -8, bottom: 6), hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr, hintStyle: TextStyle(fontSize: 22.sp, height: 1.0), //不需要输入框下划线 border: InputBorder.none, //左边图标设置 // icon: Padding( // padding: EdgeInsets.only(top:30.w, bottom: 20.w, right: 20.w, left: 20.w), // child: Image.asset('images/main/icon_main_search.png', width: 40.w, height: 40.w,), // ), // //右边图标设置 // suffixIcon: GestureDetector( // onTap: () { // //addPostFrameCallback是 StatefulWidge 渲染结束的回调,只会被调用一次 // // SchedulerBinding.instance.addPostFrameCallback((_) { // // _controller.text = ""; // // }); // }, // child: Padding( // padding: EdgeInsets.all(8), // child: Image.asset('images/main/icon_main_cell.png', width: 50.w, height: 50.w,), // ), // ) ), ), ) ], ), actions: [ CupertinoDialogAction( child: Text( TranslationLoader.lanKeys!.cancel!.tr, style: const TextStyle(color: Colors.black), ), onPressed: () { // Navigator.pop(context); // print("取消"); if (cancelClick != null) { cancelClick!(); } }, ), CupertinoDialogAction( child: Text(TranslationLoader.lanKeys!.sure!.tr, style: const TextStyle(color: Colors.black)), onPressed: () { if (sureClick != null) { sureClick!(); } // Navigator.pop(context); // print("确定"); }, ), ], ), ); } }