【发布时间】:2019-04-30 11:13:58
【问题描述】:
我想为 TextField 小部件创建一个自定义小部件,并且我想将所有属性传输到我的自定义小部件。我在 React Native 中使用过 ...props 语法。
我的自定义小部件:
return Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1,
),
borderRadius: BorderRadius.all(Radius.circular(5))),
margin: margin,
padding: EdgeInsets.symmetric(horizontal: 10),
child: TextField(
decoration: InputDecoration(
labelStyle: TextStyle(color: Colors.black),
labelText: label,
border: InputBorder.none,
counterText: ""),
textDirection: TextDirection.ltr,
//I want to put here custom widget properties
),
);
我想使用自定义小部件,例如:
Input(
label: "Şifre",
margin: EdgeInsets.only(bottom: marginBottom),
obscureText: true, //**
textInputAction: TextInputAction.send, //**
controller: passwordController, //**
)
我想将带注释的 ** 属性转移到自定义小部件的注释行
【问题讨论】: