57 lines
1.7 KiB
Dart
57 lines
1.7 KiB
Dart
|
|
import 'package:flutter/cupertino.dart';
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:flutter/services.dart';
|
||
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||
|
|
|
||
|
|
/*
|
||
|
|
* 登录注册页面 input
|
||
|
|
* */
|
||
|
|
|
||
|
|
class LoginInput extends StatelessWidget {
|
||
|
|
|
||
|
|
TextEditingController controller;
|
||
|
|
List<TextInputFormatter> inputFormatters;
|
||
|
|
TextInputType keyboardType;
|
||
|
|
Color background;
|
||
|
|
String hintText;
|
||
|
|
String leftImg;
|
||
|
|
String label;
|
||
|
|
bool isPwd;
|
||
|
|
Widget rightSlot;
|
||
|
|
LoginInput({Key key, @required this.controller,this.rightSlot,this.label,this.isPwd,this.inputFormatters,this.keyboardType,this.background,this.hintText, this.leftImg}) : super(key: key);
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return Container(
|
||
|
|
// color: Colors.red,
|
||
|
|
// width: 1.sp,
|
||
|
|
// height: 200.h,
|
||
|
|
child: Column(
|
||
|
|
children: [
|
||
|
|
TextField(
|
||
|
|
//输入框一行
|
||
|
|
maxLines: 1,
|
||
|
|
controller: controller,
|
||
|
|
autofocus: false,
|
||
|
|
decoration: InputDecoration(
|
||
|
|
//输入里面输入文字内边距设置
|
||
|
|
contentPadding: const EdgeInsets.only(
|
||
|
|
top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
|
||
|
|
labelText: label,
|
||
|
|
hintText: hintText,
|
||
|
|
//不需要输入框下划线
|
||
|
|
border: InputBorder.none,
|
||
|
|
//左边图标设置
|
||
|
|
icon: (leftImg.isNotEmpty)?Padding(
|
||
|
|
padding: EdgeInsets.only(top:30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||
|
|
child: Image.asset(leftImg, width: 40.w, height: 40.w,),
|
||
|
|
):SizedBox(width: 65.w, height: 40.w,),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
Container(height: 0.5.h, color: Colors.grey,),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|