changing color of drawer doesnt show color onhover

105

You should change canvasColor in your ThemeData in main.dart

import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: YourHomeWidget(),
    theme: ThemeData.light().copyWith(
      canvasColor: Colors.grey,
    ),
  ));
}

I have answered your question here.

Share:
105
marcosagni98
Author by

marcosagni98

student/developer

Updated on November 20, 2022

Comments

  • marcosagni98
    marcosagni98 over 1 year

    I'm making a drawer, and I want to change the background color, but when I select the color on the container, the color change onhover is not shown, if the color is as deffault works as usual

    drawer

    return new Drawer(
        child: Container(
          height: _containerHeight,
          color: const Color(0xff68778d),
          child: ListView(
            padding: EdgeInsets.zero,
            itemExtent: _containerHeight < 900 ? _containerHeight/_numberOfListTiles: null,
            children: [
                  listTile("assets/image1", "profile", ""), 
              ),
            ],
          ),
        )
      );
    

    List tile

     Widget listTile(asset, text, action) {
          return new ListTile(
            hoverColor: const Color(0xff545e8b),
            leading: Image.asset(
              asset,
              fit: BoxFit.fitHeight,
            ),
            title: Text(
                text,
              style: TextStyle(
                fontWeight: FontWeight.bold,
                fontSize: 16,
                color: Colors.white,
              ),
            ),
            onTap: (){
              action;
            }
          );
        }
    

    is there any way to change the background color and seeing the hover animation?