Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Highlighting remains visible after changes to Slider and DropdownButton widgets #122901

Closed as not planned
@ghost

Description

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;
                });
              },
            ),
          ],
        ),
      ),
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: invalidIssue is closed as not valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions