Show a single product

Now let's show the product when we tap on an item, as you know we have a constructor that takes the product.

import 'package:flutter/material.dart';
import '../models/product.dart';

class ProductDetailsPage extends StatelessWidget {
  final Product product;
  const ProductDetailsPage({this.product});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(product.name),
      ),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text(
              product.name,
              style: TextStyle(
                fontSize: 18,
                fontWeight: FontWeight.bold,
              ),
            ),
            SizedBox(height: 20),
            Text(product.description,
                style: Theme.of(context).textTheme.bodyText1),
            SizedBox(height: 20),
            Text(
              '\$${(product.price).toString()}',
              style: TextStyle(fontWeight: FontWeight.bold),
            ),
          ],
        ),
      ),
    );
  }
}

Also don't forget to update onTap on ListTile widget in the home page.

Navigator.of(context).push(
      MaterialPageRoute(
        builder: (context) =>
            ProductDetailsPage(product: product),
      ),
    );

Finally here is what is going to happen when you tap on a single product. flutter sqflite select a single item