build method

  1. @override
Widget build (BuildContext context)

Builds Button if the app is not connected to a touchpad or animates search progress.

Implementation

@override
Widget build(BuildContext context) {
  final bBloc = BlocProvider.of(context).bluetoothBlocGetter;

  return StreamBuilder<bool>(
    stream: bBloc.isScanning$,
    initialData: false,
    builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
      if (snapshot.hasData) {
        return Container(
          margin: EdgeInsets.all(8.0),
          height: 50.0,
          width: 150.0,
          child: (snapshot.data == true)
              ? _scanAnimation()
              : _scanButton(context),
        );
      } else
        return Container();
    },
  );
}