0

I want to put objects randomly, then on new screen I want player to put widgets as before. How can I do that?

What widgets/ packages would make it easy?

helloitsme3
  • 259
  • 3
  • 13

2 Answers2

1

Say you have a list of objects in your widget, that is displayed in order by the build function.

You could use initState to shuffle your list the first time your widget loads, using a shuffle function such as the one provided in this other StackOverflow answer.

List<MyItem> items = [MyItem('first'), MyItem('second'), MyItem('third')];

@override
initState() {
  items = shuffle(items);
  super.initState();
}

Then when going to the next screen, you can pass the shuffled version of items, and use that as the 'correct' solution.

It's a bit difficult to see what exactly you're looking for as no code was provided, but hopefully this gives you some inspiration for your actual problem.

fravolt
  • 2,565
  • 1
  • 4
  • 19
0

Try to use CustomPainter and Canvas so can access Offset

kururu
  • 43
  • 5