ashwithpoojary98 / javaflutterfinder

Flutter driver with Java implementation
MIT License
10 stars 5 forks source link

Accessing the text form card widget. #7

Closed subodh-badavate closed 1 year ago

subodh-badavate commented 1 year ago

Hello @ashwithpoojary98 How can we retrieve text element from card widget because whenever i am trying that way, server says Type Card is currently not supported by getText. have you any idea? and How can we assign keys in flutter application so we can easily access flutter widgets? Is there any another way? I am simply giving keys to widgets by using key attribute of widget.

ashwithpoojary98 commented 1 year ago

Hey Hi, Create a child text widget. getText will work only for the text widget.

subodh-badavate commented 1 year ago
_card(int i, String? word) {
    return Card(
      elevation: 6,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(20),
      ),
      color: Colors.white,
      child: Center(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text(
              "$word",
              style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 40),
              key: Key("word$i"),
            )
          ],
        ),
      ), // this line
    );
  }

Please see above code, How can we retrieve the text word from above code. I am not able to find value by using function findByKeyValue method. Can you elaborate on that?

subodh-badavate commented 1 year ago

@ashwithpoojary98 we can able to do that. Thanks. I am closing this issue.