cognition_package 1.0.3 copy "cognition_package: ^1.0.3" to clipboard
cognition_package: ^1.0.3 copied to clipboard

outdated

A Flutter framework for cognitive testing. Contains 14 pre-defined cognitive tests and an API for creating your own.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:research_package_demo_app/user_demographics.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:uuid/uuid.dart';

Future main() async => {await dotenv.load(fileName: ".env"), runApp(MyApp())};

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.light().copyWith(
          primaryColor: Color(0xffC32C39),
          // ignore: deprecated_member_use
          accentColor: Color(0xff003F6E),
          elevatedButtonTheme: ElevatedButtonThemeData(style: ButtonStyle(
              backgroundColor: MaterialStateProperty.resolveWith<Color>(
                  (Set<MaterialState> states) {
            if (states.contains(MaterialState.pressed)) {
              return Color(0xffC32C39);
            } else if (states.contains(MaterialState.disabled)) {
              return Colors.grey.withOpacity(0.5);
            }
            return Color(0xffC32C39); // Use the component's default.
            // foregroundColor: MaterialStateProperty.resolveWith<Color>(
            //     (states) => Colors.white),
            // backgroundColor: MaterialStateProperty.resolveWith<Color>(
            //     (states) => Color(0xff003F6E)),
          })))),
      title: 'Cognition Package Demo',
      home: MyHomePage(),
      debugShowCheckedModeBanner: false,
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  bool fireBase = false;
  bool buttonReady = true;

  @override
  void initState() {
    super.initState();
    controlID();
  }

  void controlID() async {
    SharedPreferences sp = await SharedPreferences.getInstance();
    if (!sp.containsKey('ID')) {
      sp.setString('ID', Uuid().v4());
      sp.setInt('attempts', 0);
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xff003F6E),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Container(height: 150),
            Padding(
              padding: const EdgeInsets.all(22.0),
              child: Image.asset(
                "assets/images/mcat-logo.png",
                height: 80,
              ),
            ),
            Padding(
                padding:
                    const EdgeInsets.symmetric(vertical: 20, horizontal: 25),
                child: Column(
                  children: <Widget>[
                    Text(
                      "Welcome to the alpha-testing of cognitive tests Package, developed by Ossi Kallunki",
                      textAlign: TextAlign.center,
                      style: TextStyle(fontSize: 16, color: Colors.white),
                    ),
                    Container(height: 50),
                    Text(
                      "If you have any issues or questions feel free to contact us at",
                      textAlign: TextAlign.center,
                      style: TextStyle(fontSize: 16, color: Colors.white),
                    ),
                    Container(height: 5),
                    Text(
                      "ossi0004@gmail.com",
                      textAlign: TextAlign.center,
                      style: TextStyle(
                          fontSize: 16,
                          color: Colors.white,
                          decoration: TextDecoration.underline),
                    ),
                    //Container(height: 50),
                  ],
                )),
            Padding(
              padding: const EdgeInsets.only(top: 150),
              child: ElevatedButton(
                style: ElevatedButton.styleFrom(
                  primary: Color(0xffC32C39),
                  fixedSize: const Size(300, 60),
                ),
                child: Text(
                  "Get started",
                  style: TextStyle(fontSize: 18),
                ),
                onPressed: () {
                  Navigator.of(context).push(MaterialPageRoute(
                      builder: (context) => UserDemographicsPage()));
                },
              ),
            ),
          ],
        ),
      ),
      bottomNavigationBar: SafeArea(
          child: Padding(
        padding: const EdgeInsets.all(22.0),
        child: Image.asset(
          "assets/images/Cachet-logo-white.png",
          height: 50,
        ),
      )),
    );
  }
}
8
likes
0
pub points
71%
popularity

Publisher

verified publishercachet.dk

A Flutter framework for cognitive testing. Contains 14 pre-defined cognitive tests and an API for creating your own.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

audioplayers, flutter, flutter_localizations, flutter_swipable, json_annotation, reorderables, research_package

More

Packages that depend on cognition_package