How to import specific Widget to another file

Viewed 296

I have created this date picker

Widget completedDatePicker() => Column(
children: [
  buildDatePicker(),
  confirmButton(),
  ]);

and I want to import just this widget to another file like this enter image description here

how do I import it and should I use Stack class to make it like the picture above

2 Answers

Well you can move it to its own class with its own context(basically as a stateful or stateless widget) And then you can use it anywhere you need it.

I know it, so I use class to return widget to another file like this

class TestWidget extends StatelessWidget

{
  final Color bgColor;
  final String title;

  const TestWidget(Key key,this.title, this.bgColor) : super(key: key);
return (widget here);
}
Related