navigator push on list items

Viewed 34

i have a dashboard screen in which i have list of items ...and i want that on clicking on list item it navigate to a different screen. this is my dashboard screen. Dashboard Screen

this is my code....

class _DashboardScreenState extends State<DashboardScreen> {
  final CategoriesScroller categoriesScroller = CategoriesScroller();
  ScrollController controller = ScrollController();
  bool closeTopContainer = false;
  double topContainer = 0;

  List<Widget> itemsData = [];

  void getPostsData() {
    List<dynamic> responseList = FOOD_DATA;
    List<Widget> listItems = [];
    responseList.forEach((post) {
      listItems.add(GestureDetector(
         onTap: () {
          _navigateAndDisplaySelection(context);
        },
        child: Container(

          height: 150,
          margin: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
          decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(20.0)), color: Colors.white, boxShadow: [
            BoxShadow(color: Colors.black.withAlpha(100), blurRadius: 10.0),
          ]),
          child: Padding(
            padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 10),
            child: Row(

              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Text(
                      post["name"],
                      style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
                    ),
                    SizedBox(
                      height: 10,
                    )
                  ],
                ),
                Image.asset(
                  "assets/images/${post["image"]}",
                  height: double.infinity,
                )
              ],
            ),
          )),));
    });
    setState(() {
      itemsData = listItems;
    });
  }

and in constant.dart file i have data...

all i want is to on clicking in dashboard screen on add customer it navigate to addcustomerscreen and on clicking searchcustomer item it navigate to searchcustomerscreen.

Please help me as soon as possible. As i'm not getting any help or tutorial about that on internet.

0 Answers
Related