我似乎无法理解为什么我的应用程序没有在应用程序中显示图标,尽管它在 android studio IDE 中显示。也不会产生任何错误
未在应用中显示
代码如下:
CustomFromField(
heading: getTranslated(context, "sample_id"),
suffixIcon:IconButton(onPressed: ()=> showDialog(context: context, builder: (context)=> alert) ,icon:Icon(Icons.info)),
controller: idno,
keybardType: TextInputType.number,
),
class CustomFromField extends StatefulWidget {
final String heading;
final String hintText;
final TextEditingController controller;
final bool hideText;
final TextInputType keybardType;
final TextInputAction textInputAction;
final Color headingColor;
// final FocusNode focusNode;
final Widget suffixIcon;
Function onChanged;
Function validation;
Function onTap;
CustomFromField(
{this.hintText = '',
this.controller,
this.hideText = false,
this.keybardType,
this.onChanged,
this.suffixIcon,
this.validation,
this.headingColor,
this.onTap,
this.heading,
// this.focusNode,
this.textInputAction = TextInputAction.next});
@override
_CustomFromFieldState createState() => _CustomFromFieldState();
}
class _CustomFromFieldState extends State<CustomFromField> {
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 8.0, left: 8),
child: Text(
widget.heading,
style: TextStyle(
color: AppColor.primarypurple,
fontSize: 14,
fontWeight: FontWeight.w500),
),
),
Container(
child: TextFormField(
onChanged: widget.onChanged,
controller: widget.controller,
obscureText: widget.hideText,
textInputAction: widget.textInputAction,
keyboardType: widget.keybardType,
validator: widget.validation,
onTap: widget.onTap,
// focusNode: widget.focusNode,
style: TextStyle(color: AppColor.primaryColor, fontSize: 14),
decoration: InputDecoration(
isDense: true,
contentPadding:
EdgeInsets.symmetric(horizontal: 10, vertical: 10),
border: new OutlineInputBorder(
borderRadius: const BorderRadius.all(
const Radius.circular(10.0),
),
borderSide:
BorderSide(color: AppColor.primaryColor, width: 2)),
focusedBorder: new OutlineInputBorder(
borderRadius: const BorderRadius.all(
const Radius.circular(10.0),
),
borderSide:
BorderSide(color: AppColor.primaryColor, width: 2)),
enabledBorder: new OutlineInputBorder(
borderRadius: const BorderRadius.all(
const Radius.circular(10.0),
),
borderSide: BorderSide(color: AppColor.darkBlue, width: 2)),
filled: true,
hintText: widget.hintText,
hintStyle: TextStyle(color: AppColor.secondaryColor, fontSize: 14),
focusColor: AppColor.primaryColor,
labelStyle: TextStyle(color: AppColor.primaryColor),
fillColor: AppColor.backGrey),
),
),
const SizedBox(
height: 15,
)
],
);
}
}
我正在研究,一种解决方案是检查 uses-material design:true 是否添加到 pubspec.yaml 中,但这对我的项目没有影响。