Highlighting remains visible after changes to Slider and DropdownButton widgets

This issue has been tracked since 2023-03-17.

The highlighting around the slider tick remains visible after the change to the widget completes, same goes for highlighting on dropdown items. The issue was found on a linux desktop app but can be reproduced in dart pad, see code below.

Screenshot from 2023-03-17 10-02-03
Screenshot from 2023-03-17 10-02-07
Screenshot from 2023-03-17 10-02-14
Screenshot from 2023-03-17 10-02-19
Screenshot from 2023-03-17 10-02-23
Screenshot from 2023-03-17 10-02-28
Screenshot from 2023-03-17 10-02-35

// Copyright (c) 2019, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  final String title;

  const MyHomePage({
    Key? key,
    required this.title,
  }) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  double sliderValue = 0;
  String dropdownValue = 'a';

  List<DropdownMenuItem> getItems() {
    List<DropdownMenuItem> items = [];
    for (String label in ['a', 'b', 'c']) {
      items.add(
        DropdownMenuItem(
          value: label,
          child: Text(label),
        ),
      );
    }
    return items;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            DropdownButton(
                value: dropdownValue,
                items: getItems(),
                onChanged: (value) {
                  setState(() {
                    dropdownValue = value;
                  });
                }),
            Slider(
              value: sliderValue,
              min: 0,
              max: 10,
              onChanged: (value) {
                setState(() {
                  sliderValue = value;
                });
              },
            ),
          ],
        ),
      ),
    );
  }
}
jason-simmons wrote this answer on 2023-03-18

This behavior was implemented based on the Material 3 specification (see #113543)

himanshu21072002 wrote this answer on 2023-03-18

Hi,
My name is Himanshu Gangwar, I have been working with flutter for more than one and a half year.
I want to solve this issue so can you please assign this issue to me.

More Details About Repo
Owner Name flutter
Repo Name flutter
Full Name flutter/flutter
Language Dart
Created Date 2015-03-06
Updated Date 2023-03-30
Star Count 151602
Watcher Count 3555
Fork Count 25000
Issue Count 11498

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date