Skip to content

Property editor input state doesn't update when switching between invocations #8926

@DanTup

Description

@DanTup

I'm not certain this isn't ultimately the same as #8924, but when switching between widget invocations (without any interaction with the property editor), the values in the input boxes don't update.

Here, I switch between two invocations that have different argument values (arg 1111111 and arg 2222222) but the property editor always shows the same value (the label does update to arg2):

prop_editor_2.mp4

This is the code I'm using to test:

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: '',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const MyHomePage(title: 'testtttttt'),
      initialRoute: 'testtttttt',
      themeMode: ThemeMode.system,
      debugShowMaterialGrid: false,
      showPerformanceOverlay: false,
      restorationScopeId: '',
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(''),
            MyWidget1(arg1: "arg 1111111"),
            MyWidget2(arg2: 'arg 2222222'),
          ],
        ),
      ),
    );
  }
}

class MyWidget1 extends StatelessWidget {
  final String? arg1;

  const MyWidget1({super.key, this.arg1});

  @override
  Widget build(BuildContext context) {
    return const Placeholder();
  }
}

class MyWidget2 extends StatelessWidget {
  final String? arg2;

  const MyWidget2({super.key, this.arg2});

  @override
  Widget build(BuildContext context) {
    return const Placeholder();
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1high priority issues at the top of the work list, actively being worked on.bugSomething isn't workingbug bashfound during a bug bashproperty editor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions