Blame view

lib/common/widgets/textfield_customer_widget.dart 2.2 KB
4bf67b91   liangchengyou   feat:设置密码
1
  import 'package:flutter/material.dart';
c9df43c8   Key   feat: 修改个人信息、接口
2
  import 'package:flutter/services.dart';
4bf67b91   liangchengyou   feat:设置密码
3
4
5
  import 'package:flutter_screenutil/flutter_screenutil.dart';
  import 'package:wow_english/common/extension/string_extension.dart';
  
1d5315dd   liangchengyou   feat:添加字体,调整文件结构
6
  class TextFieldCustomerWidget extends StatefulWidget {
c9df43c8   Key   feat: 修改个人信息、接口
7
8
    const TextFieldCustomerWidget({
      super.key,
4bf67b91   liangchengyou   feat:设置密码
9
10
11
12
13
14
15
16
17
      this.controller,
      this.hitStyle,
      this.textStyle,
      this.bgImageName,
      this.hitText,
      this.width,
      this.height,
      this.textAlign,
      this.textInputType,
1d5315dd   liangchengyou   feat:添加字体,调整文件结构
18
      this.obscureText,
c9df43c8   Key   feat: 修改个人信息、接口
19
20
      this.onChangeValue,
      this.inputFormatters,
4bf67b91   liangchengyou   feat:设置密码
21
22
23
24
25
26
27
28
29
30
31
    });
  
    final TextEditingController? controller;
    final TextStyle? hitStyle;
    final TextStyle? textStyle;
    final String? bgImageName;
    final String? hitText;
    final double? width;
    final double? height;
    final TextAlign? textAlign;
    final TextInputType? textInputType;
1d5315dd   liangchengyou   feat:添加字体,调整文件结构
32
    final bool? obscureText;
4bf67b91   liangchengyou   feat:设置密码
33
    final Function(String value)? onChangeValue;
c9df43c8   Key   feat: 修改个人信息、接口
34
    final List<TextInputFormatter>? inputFormatters;
4bf67b91   liangchengyou   feat:设置密码
35
36
37
  
    @override
    State<StatefulWidget> createState() {
1d5315dd   liangchengyou   feat:添加字体,调整文件结构
38
      return _TextFieldCustomerWidgetState();
4bf67b91   liangchengyou   feat:设置密码
39
40
41
    }
  }
  
1d5315dd   liangchengyou   feat:添加字体,调整文件结构
42
  class _TextFieldCustomerWidgetState extends State<TextFieldCustomerWidget> {
4bf67b91   liangchengyou   feat:设置密码
43
44
45
    @override
    Widget build(BuildContext context) {
      return Container(
c9df43c8   Key   feat: 修改个人信息、接口
46
47
        height: widget.height ?? 45.h,
        width: widget.width ?? double.infinity,
4bf67b91   liangchengyou   feat:设置密码
48
49
50
        alignment: Alignment.center,
        decoration: BoxDecoration(
            image: DecorationImage(
e6a4e63c   Key   fixed: 修改个人信息性别
51
52
53
          image: AssetImage('${widget.bgImageName}'.assetPng),
          fit: BoxFit.fill,
        )),
4bf67b91   liangchengyou   feat:设置密码
54
        child: TextField(
c9df43c8   Key   feat: 修改个人信息、接口
55
          inputFormatters: widget.inputFormatters,
4bf67b91   liangchengyou   feat:设置密码
56
          controller: widget.controller,
c9df43c8   Key   feat: 修改个人信息、接口
57
          textAlign: widget.textAlign ?? TextAlign.center,
4bf67b91   liangchengyou   feat:设置密码
58
59
          textInputAction: TextInputAction.done,
          keyboardType: widget.textInputType,
c9df43c8   Key   feat: 修改个人信息、接口
60
          obscureText: widget.obscureText ?? false,
4bf67b91   liangchengyou   feat:设置密码
61
          decoration: InputDecoration(
c9df43c8   Key   feat: 修改个人信息、接口
62
63
64
65
66
67
68
69
              hintText: widget.hitText ?? '',
              border: InputBorder.none,
              hintStyle: widget.hitStyle ?? TextStyle(fontSize: 16.sp, color: const Color(0xFF999999))),
          style: widget.textStyle ??
              TextStyle(
                color: const Color(0xFF333333),
                fontSize: 16.sp,
              ),
4bf67b91   liangchengyou   feat:设置密码
70
71
72
73
74
          onChanged: widget.onChangeValue,
        ),
      );
    }
  }