104 lines
3.2 KiB
Dart
Executable File
104 lines
3.2 KiB
Dart
Executable File
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:star_lock/app_settings/app_colors.dart';
|
|
|
|
import '../translations/trans_lib.dart';
|
|
|
|
class ShowTFView extends StatelessWidget {
|
|
String? title;
|
|
String? tipTitle;
|
|
String? leftBtnTitle;
|
|
String? rightBtnTitle;
|
|
bool? isShowSuffixIcon;
|
|
TextEditingController? controller;
|
|
List<TextInputFormatter>? inputFormatters;
|
|
TextInputType? keyboardType;
|
|
Function()? sureClick;
|
|
Function()? cancelClick;
|
|
|
|
ShowTFView(
|
|
{Key? key,
|
|
this.title,
|
|
this.tipTitle,
|
|
this.leftBtnTitle,
|
|
this.rightBtnTitle,
|
|
this.isShowSuffixIcon,
|
|
this.controller,
|
|
this.inputFormatters,
|
|
this.keyboardType,
|
|
this.sureClick,
|
|
this.cancelClick})
|
|
: super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
height: 60.h,
|
|
color: const Color(0x00FFFFFF),
|
|
child: CupertinoAlertDialog(
|
|
title: Text(title!),
|
|
content: Column(
|
|
children: <Widget>[
|
|
// const SizedBox(
|
|
// height: 10,
|
|
// ),
|
|
Container(
|
|
height: 60.h,
|
|
// color: Colors.white,
|
|
// padding: EdgeInsets.only(left:20.w, right: 110.w),
|
|
margin: EdgeInsets.only(top: 20.w),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(15.w)),
|
|
child: TextField(
|
|
//输入框一行
|
|
maxLines: 1,
|
|
controller: controller,
|
|
autofocus: false,
|
|
inputFormatters: inputFormatters,
|
|
keyboardType: keyboardType,
|
|
decoration: InputDecoration(
|
|
contentPadding: EdgeInsets.only(left: 5, top: isShowSuffixIcon??false ? 0 : -8, bottom: 6),
|
|
hintText: tipTitle??'请输入'.tr,
|
|
hintStyle: TextStyle(fontSize: 22.sp, height: 1.0),
|
|
//不需要输入框下划线
|
|
border: InputBorder.none,
|
|
suffixIcon: isShowSuffixIcon??false ? IconButton(
|
|
onPressed: () => controller?.clear(),
|
|
icon: const Icon(Icons.clear),
|
|
) : null,
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
actions: <Widget>[
|
|
CupertinoDialogAction(
|
|
child: Text(leftBtnTitle ?? '取消'.tr,
|
|
style: TextStyle(color: AppColors.mainColor)),
|
|
onPressed: () {
|
|
// Navigator.pop(context);
|
|
if (cancelClick != null) {
|
|
cancelClick!();
|
|
}
|
|
},
|
|
),
|
|
CupertinoDialogAction(
|
|
child: Text(rightBtnTitle ?? '确定'.tr,
|
|
style: TextStyle(color: AppColors.mainColor)),
|
|
onPressed: () {
|
|
if (sureClick != null) {
|
|
sureClick!();
|
|
}
|
|
// Navigator.pop(context);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|