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

根据 https://stackoverflow.com/questions/49208772/error-resource-androidattr-fontvariationsettings-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,

 

 
posted @ 2019-02-27 11:36  balder_m  阅读(289)  评论(0编辑  收藏  举报