-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draggable widget childWhenDragging
not rendering updates
#39406
Comments
The question is open at https://stackoverflow.com/questions/57472626/how-to-update-draggable-feedback-widget-while-dragging. But seems it's a bug with flutter itself. |
Persists with current master flutter doctor -v
|
I was experiencing this issue and found that wrapping the feedback widget in a container with specified height and width fixed this problem. My guess is if the feedback widget does not have anything to render inside, it renders to 1 or 0 pixels because the widget sort of "breaks out" of the parent's constraints. |
@dominic-deantonio No sure I follow. In my minimal example the feedback widget has a fixed width and height. It is displayed when dragging but its data (Text value) is not rerendered while dragging and clicking the button at the same time. Did you have the same issue? And if so how would you solve it in the minimal example? https://dartpad.dev/b6409e10de32b280b8938aa75364fa7b |
I am able to reproduce the issue on the latest stable 3.3 and master 3.6. The Screen.Recording.2022-11-28.at.11.52.33.PM.movcode sampleimport 'package:flutter/material.dart';
void main() async {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Draggable Test',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
late int counter;
@override
void initState() {
counter = 0;
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Draggable Test'),
),
body: Column(
children: <Widget>[
Draggable(
feedback: Container(
color: Colors.red,
width: 100,
height: 100,
child: Text(counter.toString(),style: TextStyle(color: Colors.white),),
),
childWhenDragging: Container(
color: Colors.red,
width: 100,
height: 100,
child: Text(counter.toString(),style: TextStyle(color: Colors.white),),
),
child: Container(
color: Colors.red,
width: 100,
height: 100,
child: Text(counter.toString(),style: TextStyle(color: Colors.white),),
),
),
ElevatedButton(
onPressed: () {
setState(() {
counter += 1;
});
},
child: const Text("plus"),
)
],
),
);
}
} flutter doctor -v (mac)
|
childWhenDragging
not rendering updates
Updates are rendered to the childWhenDragging widget but not to the feedback widget.
Steps to Reproduce
https://gist.github.com/mannfeldt/e33e2f8324b783a8fd5b5252f7eedc1b
The text was updated successfully, but these errors were encountered: