小编Cre*_*tor的帖子

TextSelectionThemeData 不会更改颤振中的 SelectionHandleColor

在物理设备和模拟器上进行了测试。

众所周知,textSelectionHandleColor 已被弃用。因此,我决定对我的应用程序代码进行一些更改,不幸的是,selectionHandleColor 仍然是我们创建新应用程序时获得的默认蓝色。

TextSelectionTheme(
              data: TextSelectionThemeData(
                  cursorColor: kLightGreen,
                  selectionHandleColor: kLightGreen,
                  selectionColor: kGrey),
              child: TextField(
                keyboardType: TextInputType.number,
                style: TextStyle(
                  color: kOffWhite,
                  letterSpacing: 1.5,
                ),
                decoration: InputDecoration(
                  labelText: 'Label',
                  enabledBorder: UnderlineInputBorder(
                    borderSide: BorderSide(color: kLightGreen),
                  ),
                  focusedBorder: UnderlineInputBorder(
                    borderSide: BorderSide(color: kLightGreen),
                  ),
                  hintText: 'Hint',
                  hintStyle: TextStyle(
                    color: kOffWhite,
                    letterSpacing: 1.5,
                  ),
                  labelStyle: TextStyle(
                    color: kLightGreen,
                    letterSpacing: 1.5,
                  ),
                ),
              ),
            ),
Run Code Online (Sandbox Code Playgroud)

除手柄颜色外,光标颜色、选择颜色均已更改。我已尝试了一切可能的方法来更改文本选择手柄颜色。

textfield textselection dart flutter

9
推荐指数
1
解决办法
1539
查看次数

如何在颤动的列表视图中设置卡片的宽度?

我有一个卡片列表,但是当我更改卡片的宽度时,它仍然采用与父容器相同的宽度。我尝试过用大小合适的盒子或容器包装列表视图、卡片甚至滚动视图,但没有任何效果。

  Container(
              height: MediaQuery.of(context).size.height * 0.6,
              width: MediaQuery.of(context).size.width * 0.8,
              decoration: BoxDecoration(
                color: kWhiteColor,
                borderRadius: BorderRadius.all(
                    Radius.circular(MediaQuery.of(context).size.height * 0.02)),
              ),
              child: Padding(
                padding:
                    EdgeInsets.all(MediaQuery.of(context).size.height * 0.015),
                child: SingleChildScrollView(
                  scrollDirection: Axis.vertical,
                  child: ListView.builder(
                    physics: const NeverScrollableScrollPhysics(),
                    shrinkWrap: true,
                    itemCount: 10,
                    itemBuilder: (BuildContext context, int index) {
                      return SizedBox(
                        width: MediaQuery.of(context).size.width*0.001,
                        height: MediaQuery.of(context).size.height*0.3,
                        child: Card(
                          color: Colors.black,
                        ),
                      );
                    },
                  ),
                ),
              ),
            ),
Run Code Online (Sandbox Code Playgroud)

我面临的问题

白卡后面是父容器,或者我们可以说是最外层的容器。

listview resize dart flutter card

2
推荐指数
1
解决办法
5661
查看次数

标签 统计

dart ×2

flutter ×2

card ×1

listview ×1

resize ×1

textfield ×1

textselection ×1