import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:wormhole_jp/style/color.dart';
class comSystemInput extends StatelessWidget {
final TextEditingController textEditingController;
final String hintText;
final Widget prefixIcon;
final Widget? suffixIcon;
final bool? readOnly;
const comSystemInput(
{super.key,
required this.textEditingController,
required this.hintText,
required this.prefixIcon,
this.suffixIcon,
this.readOnly});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 12, right: 12),
child: TextFormField(
controller: textEditingController,
onEditingComplete: () {
FocusScope.of(context).unfocus();
},
inputFormatters: [
LengthLimitingTextInputFormatter(50),
FilteringTextInputFormatter.allow(RegExp("[0-9.]"))
],
keyboardType: TextInputType.number,
textInputAction: TextInputAction.done,
readOnly: readOnly != null ? readOnly! : false,
enableInteractiveSelection: false,
enableIMEPersonalizedLearning: false,
toolbarOptions: ToolbarOptions(
copy: true,
cut: true,
paste: true,
selectAll: true,
),
decoration: InputDecoration(
focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(color: Colors.red, width: 2)),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(color: appColor.buttom, width: 2)),
hintText: hintText,
hintStyle:
GoogleFonts.notoSans(color: appColor.black.withOpacity(0.3)),
prefixIcon: prefixIcon,
suffixIcon: suffixIcon != null ? suffixIcon : null,
suffixIconConstraints: BoxConstraints(
maxHeight: 35,
maxWidth: 43,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(color: appColor.black.withOpacity(0.5))),
),
),
);
}
}
版权属于:
narakuyang
作品采用:
《
署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
》许可协议授权
评论