skip to Main Content

I am creating an app for android Tv using Flutter.I want to implement a feature in which if an InkWell has focus there should be boundary visible.

Container(
      decoration: BoxDecoration(
          border: Border.all(
              color: _focusNode.hasFocus ? Colors.black : Colors.transparent)),
      child: InkWell(
          focusNode: _focusNode,
          onTap: () {
            if (onTap != null) {
              onTap();
            }
          },
          onDoubleTap: onDoubleTap,
          borderRadius: borderRadius ?? BorderRadius.circular(50),
          child: child),
    );

2

Answers


  1. Try by adding this line in inkwell:

    splashColor: Colors.grey,
    
    Login or Signup to reply.
  2. your are not proper manage focus request.

    Container(
            decoration: BoxDecoration(
                border: Border.all(
                    color: _focusNode.hasFocus
                        ? Colors.black
                        : Colors.transparent)),
            child: InkWell(
                focusNode: _focusNode,
                onTap: () {
                  setState(() {
                    FocusScope.of(context).requestFocus(_focusNode);
                  });
                },
                 onDoubleTap:(){
                   _focusNode.unfocus();
                 },
                 borderRadius: BorderRadius.circular(50),
                child: Text("Hello")),
          )
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search