How to show the book details when clicking on a book



I have a snapshotData variable which contains the field author which is used in a searched bar to find book. I then have a widget searchedData which displays a list of books based on the author:

 Widget searchedData() {
      return ListView.builder(
        itemBuilder: (BuildContext context, int index) {
          return GestureDetector(
            onDoubleTap: () {
                  transition: Transition.downToUp,
            child: ListTile(
              leading: const Icon(Icons.account_circle),
              title: Text(
                style: const TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 24.0),
              subtitle: Text(
                style: const TextStyle(
                    fontWeight: FontWeight.normal,
                    fontSize: 24.0),

when someone double taps on a book in the GestureDetector i want to show another page which should display the book details specificly from the tappped book:

 Widget showBookDetails() {
    return Scaffold(

But when i double tap on a book i get error:

You are trying to use contextless navigation without
      a GetMaterialApp or Get.key.
      If you are testing your app, you can use:
      [Get.testMode = true], or if you are running your app on
      a physical device or emulator, you must exchange your [MaterialApp]
      for a [GetMaterialApp].

How can i make sure that when i tap on a book in searchedData, i can display the book details in the widget showBookDetails?


So i resolved the error mentioned by changing MaterialApp with GetMaterialApp in the main.dart. So i will close this post as solved and ask another question regarding how i can display the book details when tapping on a book


You are using for navigation, change MaterialApp widget with GetMaterialApp. Probably it’s in main.dart file.

Answered By – ertgrull

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More