getFooterButtonsWidget method
Implementation
List<Widget> getFooterButtonsWidget() {
// work out the states of the footer buttons based on the app state
List<Widget> pfb = [];
switch (currentState) {
case ApplicationState.disconnected:
pfb.add(TextButton(
onPressed: scanOrReconnectFrame, child: const Text('Connect')));
pfb.add(const TextButton(onPressed: null, child: Text('Start')));
pfb.add(const TextButton(onPressed: null, child: Text('Stop')));
pfb.add(const TextButton(onPressed: null, child: Text('Disconnect')));
break;
case ApplicationState.initializing:
case ApplicationState.scanning:
case ApplicationState.connecting:
case ApplicationState.starting:
case ApplicationState.running:
case ApplicationState.canceling:
case ApplicationState.stopping:
case ApplicationState.disconnecting:
pfb.add(const TextButton(onPressed: null, child: Text('Connect')));
pfb.add(const TextButton(onPressed: null, child: Text('Start')));
pfb.add(const TextButton(onPressed: null, child: Text('Stop')));
pfb.add(const TextButton(onPressed: null, child: Text('Disconnect')));
break;
case ApplicationState.connected:
pfb.add(const TextButton(onPressed: null, child: Text('Connect')));
pfb.add(TextButton(
onPressed: startApplication, child: const Text('Start')));
pfb.add(const TextButton(onPressed: null, child: Text('Stop')));
pfb.add(TextButton(
onPressed: disconnectFrame, child: const Text('Disconnect')));
break;
case ApplicationState.ready:
pfb.add(const TextButton(onPressed: null, child: Text('Connect')));
pfb.add(const TextButton(onPressed: null, child: Text('Start')));
pfb.add(
TextButton(onPressed: stopApplication, child: const Text('Stop')));
pfb.add(const TextButton(onPressed: null, child: Text('Disconnect')));
break;
}
return pfb;
}