Skip to content

Whole app is jumping after update #110957

@krll-kov

Description

@krll-kov

j4KEge8GJH
All elements in my Flutter apps started jumping after updating to Flutter 3.3.0.

I have several projects and this issue is reproducible in all apps where i use any Animated... widget(AnimatedOpacity, AnimatedSwitcher, AnimatedContainer, ...)

Code sample
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Material App',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Material App Bar'),
        ),
        body: Center(
          child: SingleChildScrollView(
            child: Column(
              children: <Widget>[
                for (int i = 0; i < 100; i++)
                  Padding(
                    padding: const EdgeInsets.only(top: 100),
                    child: EasyCheckbox(
                      isChecked: false,
                      onChanged: (_) {
                        /* Do something */
                      },
                      title: 'Test Title 123',
                      description: 'Bad update :C',
                      width: 300,
                    ),
                  ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

class EasyCheckbox extends StatefulWidget {
  final bool isChecked;
  final Function onChanged;
  final String title;
  final String? description;
  final double? width;
  final TextStyle? textStyle;
  final Color? textColor;
  final bool isLocked;

  const EasyCheckbox({
    super.key,
    this.isChecked = false,
    required this.onChanged,
    required this.title,
    this.description,
    this.width,
    this.textStyle,
    this.textColor,
    this.isLocked = false,
  });

  @override
  _EasyCheckboxState createState() => _EasyCheckboxState();
}

class _EasyCheckboxState extends State<EasyCheckbox> {
  late bool value = widget.isChecked;
  Color? _color;

  @override
  Widget build(BuildContext context) {
    return IgnorePointer(
      ignoring: widget.isLocked,
      child: SizedBox(
        width: widget.width,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Row(
              children: [
                MouseRegion(
                  cursor: SystemMouseCursors.click,
                  onEnter: (_) => setState(
                    () => _color = Colors.blueGrey,
                  ),
                  onExit: (_) => setState(() => _color = Colors.grey),
                  child: GestureDetector(
                    onTap: () {
                      setState(() => value = !value);
                      widget.onChanged(value);
                    },
                    child: Container(
                      padding: const EdgeInsets.symmetric(
                        horizontal: 4.0,
                        vertical: 6.0,
                      ),
                      decoration: BoxDecoration(
                        color: Colors.black12,
                        boxShadow: [
                          BoxShadow(
                            color: Colors.black.withOpacity(0.11),
                            blurRadius: 4.0,
                            offset: const Offset(
                              0.0,
                              2.0,
                            ), // changes position of shadow
                          ),
                        ],
                        borderRadius: const BorderRadius.all(
                          Radius.circular(6.0),
                        ),
                      ),
                      child: AnimatedOpacity(
                        duration: const Duration(milliseconds: 350),
                        curve: Curves.easeInOutCubic,
                        opacity: value ? 1.0 : 0.0,
                        child: const Icon(
                          Icons.check,
                          size: 8.0,
                          color: Colors.blue,
                        ),
                      ),
                    ),
                  ),
                ),
                const SizedBox(width: 10.0),
                Expanded(
                  child: Text(
                    widget.title,
                    style: TextStyle(
                      fontSize: 14.0,
                      fontWeight: FontWeight.w600,
                      color: widget.textColor,
                    ),
                    textAlign: TextAlign.left,
                  ),
                ),
              ],
            ),
            if (widget.description != null)
              Padding(
                padding: const EdgeInsets.only(
                  left: 28.0,
                  top: 0.5,
                ),
                child: Text(
                  widget.description!,
                  style: const TextStyle(
                    fontSize: 13.0,
                    fontWeight: FontWeight.w500,
                    color: Colors.grey,
                  ),
                  textAlign: TextAlign.left,
                ),
              ),
          ],
        ),
      ),
    );
  }
}
There is also a huge performance issue, animations are not smooth as before, apps lag on startup for some time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: regressionIt was better in the past than it is nowengineflutter/engine related. See also e: labels.team-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions