flutter 疑难杂症
1. TextField无法正常显示
解决方法: 添加 Expanded
new Expanded( child: new TextField(
2. TextField显示位置偏离
解决方法: border: InputBorder.none, contentPadding: new EdgeInsets.all(0.0)
new Expanded( child: new TextField( controller: NameController, //keyboardType: TextInputType.text, textAlign: TextAlign.center, autocorrect: true, style: new TextStyle( fontSize: 14, //字体大小 color: const Color(0xff000000), ), decoration: new InputDecoration( //contentPadding: EdgeInsets.all(10.0), hintText: '请输入负责人姓名', hintStyle: new TextStyle(fontSize: 14.0), border: InputBorder.none, contentPadding: new EdgeInsets.all(0.0) ), autofocus: false, ), )
2. AppBar多出一部分显示
解决方案 添加 automaticallyImplyLeading: false
child: AppBar( title: TabBar( controller: _tabController, tabs: myTabs, labelColor: Color(0xff333333), unselectedLabelColor: Color(0xff999999), indicatorColor: Color(0xff333333), ), automaticallyImplyLeading: false,//这个控制多余的空白是否显示 backgroundColor: Color(0xffffffff), titleSpacing: 0, ),
4. tabBar 和tabview作为子控件不能显示
5.无缘无故报错
error: resource android:attr/dialogCornerRadius not found error: resource android:attr/fontVariationSettings not found error: resource android:attr/ttcIndex not found
修改build.gradle里面的
android {
compileSdkVersion 28
重新运行,一切正常
保证不被刘海屏遮挡控件
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
集成插件,引用本地插件
https://blog.csdn.net/hekaiyou/article/details/72862653
平台判定
theme: defaultTargetPlatform == TargetPlatform.iOS
? iOSTheme
: AndroidTheme,
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步