inPlace method

Widget inPlace()

inPlace is a widget that shows only filed or preview and a switch to switch between them.

Implementation

Widget inPlace() {
  bool isPreviewing = false;
  return StatefulBuilder(builder: (context, setstate) {
    return Column(
      children: [
        Switch(
          value: isPreviewing,
          onChanged: (value) {
            setstate(() {
              isPreviewing = value;
            });
          },
        ),
        Stack(
          children: [
            if (!isPreviewing)
              Column(
                children: [
                  field,
                  icons,
                ],
              ),
            if (isPreviewing) preview,
          ],
        ),
      ],
    );
  });
}