build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Build the main test phase

Implementation

@override
Widget build(BuildContext context) {
  var locale = CPLocalizations.of(context);
  return Scaffold(
    body: Center(
      child: Column(
        children: [
          SizedBox(
            height: MediaQuery.of(context).size.height - 270,
            width: MediaQuery.of(context).size.width - 20,
            child: LayoutBuilder(
              builder: (context, constraints) {
                return Stack(
                  children: getDots(
                    amountOfDots,
                    amountOfTargets,
                    constraints,
                    dotSize,
                  ),
                );
              },
            ),
          ),
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 0),
            child: SizedBox(
              width: MediaQuery.of(context).size.width,
              child: !guess
                  ? waiting
                        ? Container()
                        : Center(
                            child: Column(
                              children: [
                                OutlinedButton(
                                  style: ButtonStyle(
                                    padding: WidgetStateProperty.all(
                                      const EdgeInsets.symmetric(
                                        horizontal: 24,
                                        vertical: 16,
                                      ),
                                    ),
                                    shape: WidgetStateProperty.all(
                                      RoundedRectangleBorder(
                                        borderRadius: BorderRadius.circular(
                                          6,
                                        ),
                                      ),
                                    ),
                                  ),
                                  onPressed: () {
                                    startTest();
                                  },
                                  child: Text(
                                    locale?.translate('start') ?? 'Start',
                                    style: const TextStyle(fontSize: 18),
                                  ),
                                ),
                                Text('task $conCurrentNum/$numberOfTests'),
                              ],
                            ),
                          )
                  : finished
                  ? Center(
                      child: Text(
                        locale?.translate('continue') ??
                            "Click 'Next' to continue",
                        style: const TextStyle(fontSize: 18),
                      ),
                    )
                  : Center(
                      child: Text(
                        locale?.translate(
                              'visual_tracking.press_previously',
                            ) ??
                            'Press the dots which previously were blue.',
                      ),
                    ),
            ),
          ),
        ],
      ),
    ),
  );
}