Blame view

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