You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class TelTextField extends StatefulWidget {
final TextEditingController controller;
const TelTextField({Key? key, required this.controller}) : super(key: key);
@override
_TelTextFieldState createState() => _TelTextFieldState();
}
class _TelTextFieldState extends State<TelTextField> {
@override
Widget build(BuildContext context) {
return Container(
width: 686.w,
height: 94.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(60.w),
color: Colors.black.withOpacity(0.06),
),
child: TextField(
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
keyboardType: TextInputType.number,
controller: widget.controller,
decoration: InputDecoration(
isDense: true,
border: InputBorder.none,
prefixIcon: Center(child: '+86'.text.black.make()),
prefixIconConstraints: BoxConstraints.loose(Size(60, 60)),
contentPadding: EdgeInsets.symmetric(vertical: 30.w),
hintText: '点击输入手机号',
hintStyle:
TextStyle(color: Colors.black.withOpacity(0.25), fontSize: 28.sp),
),
),
);
}
}