app-starlock/star_lock/lib/tools/showTFView.dart
2023-07-11 18:37:25 +08:00

87 lines
3.0 KiB
Dart

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;
ShowTFView({Key key, this.title, this.tipTitle, this.controller}) : super(key: key);
@override
Widget build(BuildContext context) {
return Card(
color: const Color(0x00FFFFFF),
child: CupertinoAlertDialog(
title: Text(title),
content: Column(
children: <Widget>[
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: EdgeInsets.only(top: 20.h, left: 15.0, bottom: 13.h),
hintText: tipTitle,
hintStyle:TextStyle(fontSize: 28.sp),
//不需要输入框下划线
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: <Widget>[
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys.cancel.tr),
onPressed: () {
Navigator.pop(context);
// print("取消");
},
),
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys.sure.tr),
onPressed: () {
Navigator.pop(context);
// print("确定");
},
),
],
),
);
}
}