在Flutter中更改文本框Thumb?

时间:2019-01-26 12:33:46

标签: android flutter flutter-layout

我正在尝试将文本字段更新为使用红色而不是绿色/蓝色。这是我目前的状态。

这是我的代码:

                TextField(
                    focusNode: focusNode,
                    autocorrect: false,
                    autofocus: false,
                    style: TextStyle(color: Colors.white),
                    cursorColor: Colors.white,
                    decoration: InputDecoration.collapsed(
                        hintStyle: TextStyle(color: Colors.white),
                        hintText: "FirstName"),
                  )

1 个答案:

答案 0 :(得分:1)

https://docs.flutter.io/flutter/material/ThemeData/textSelectionHandleColor.html

         final theme = Theme.of(context);
         return Theme(data: theme.copyWith(
           textSelectionHandleColor: Colors.red,
           child: TextField(
                focusNode: focusNode,
                autocorrect: false,
                autofocus: false,
                style: TextStyle(color: Colors.white),
                cursorColor: Colors.white,
                decoration: InputDecoration.collapsed(
                    hintStyle: TextStyle(color: Colors.white),
                    hintText: "FirstName"),
              )
         )