Skip to content

Scrolling list changes lead to graphical glitches #159

Closed

Description

@FlutterIssues

Issue by collinjackson
Thursday Sep 10, 2015 at 23:03 GMT
Originally opened as https://github.com/flutter/engine/issues/1125


This demo should sort a scrollable list of green bubbles by brightness when you press the sort button. But there are some graphical glitches, try scrolling around and sorting a few times.

// Copyright 2015 The Chromium Authors. 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:sky/widgets.dart';

class Circle extends Component {
  Circle(this.color);

  final Color color;

  Widget build() {
    return new Container(
      decoration: new BoxDecoration(
        shape: Shape.circle,
        backgroundColor: color
      )
    );
  }
}

List<Color> colors = [
  const Color(0x0F00FF00),
  const Color(0xCF00FF00),
  const Color(0x1F00FF00),
  const Color(0xBF00FF00),
  const Color(0xAF00FF00),
  const Color(0x9F00FF00),
  const Color(0x3F00FF00),
  const Color(0x8F00FF00),
  const Color(0x4F00FF00),
  const Color(0x7F00FF00),
  const Color(0x5F00FF00),
  const Color(0x6F00FF00)
];

class ScrollingApp extends App {
  bool shouldSort = false;

  Widget build() {
    List<Color> sortedColors = new List<Color>.from(colors);
    if (shouldSort) {
      sortedColors.sort((a, b) => a.alpha.compareTo(b.alpha));
    }
    List<Widget> circles = [];
    for(Color color in sortedColors) {
      circles.add(new Circle(color));
    }
    for(int i = 0; i < colors.length; i++)
    return new Column([
      new Container(
        height: 300.0,
        child: new ScrollableViewport(
          // key: new GlobalKey(),
          child: new Grid(
            circles,
            maxChildExtent: 150.0
          )
        )
      ),
      new Flexible(
        child: new Center(
          child: new RaisedButton(
            child: new Text("Toggle sorting"),
            onPressed: () => setState(() => shouldSort = !shouldSort)
          )
        )
      )
    ]);
  }
}

void main() {
  runApp(new ScrollingApp());
}

Activity

  1. FlutterIssues commented on Nov 9, 2015

    @FlutterIssues
    Author

    Comment by collinjackson
    Thursday Sep 10, 2015 at 23:04 GMT


    screen

  2. FlutterIssues commented on Nov 9, 2015

    @FlutterIssues
    Author

    Comment by collinjackson
    Thursday Sep 10, 2015 at 23:04 GMT


    cc @abarth @Hixie

  3. FlutterIssues commented on Nov 9, 2015

    @FlutterIssues
    Author

    Comment by Hixie
    Tuesday Sep 15, 2015 at 05:22 GMT


    cc @chinmaygarde for a first look

  4. added
    engineflutter/engine related. See also e: labels.
    on Dec 11, 2015
  5. added this to the milestone on Dec 11, 2015
  6. sethladd commented on Aug 25, 2016

    @sethladd
    Contributor

    I have a feeling this is out of date. :) Should we close?

  7. Hixie commented on Aug 25, 2016

    @Hixie
    Contributor

    We should test it :-)

  8. sethladd commented on Aug 25, 2016

    @sethladd
    Contributor

    We should test a lot of stuff :)

    Going to close, but feel free to open a new issue specific to testing.

  9. github-actions commented on Aug 17, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  10. locked as resolved and limited conversation to collaborators on Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    engineflutter/engine related. See also e: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions