research_package 1.2.0 copy "research_package: ^1.2.0" to clipboard
research_package: ^1.2.0 copied to clipboard

outdated

A Flutter framework for obtaining informed consent, showing surveys and collecting results.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:research_package/research_package.dart';

import 'informed_consent_page.dart';
import 'linear_survey_page.dart';
import 'navigable_survey_page.dart';

Future main() async => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.light(),
      darkTheme: ThemeData.dark(),
      title: 'Cognition Package Demo',
      home: MyHomePage(),
      debugShowCheckedModeBanner: false,
    );
  }
}

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

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    // initialize cognition package
    // only used if you load a cognition configuration from a json file
    ResearchPackage();

    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    RPLocalizations? locale = RPLocalizations.of(context);

    return Scaffold(
      backgroundColor: Color(0xff003F6E),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Container(height: 50),
            Padding(
              padding: const EdgeInsets.all(22.0),
              child: Image.asset(
                "assets/images/carp_logo.png",
                height: 80,
              ),
            ),
            Padding(
                padding:
                    const EdgeInsets.symmetric(vertical: 20, horizontal: 25),
                child: Column(
                  children: <Widget>[
                    Text(
                      "Welcome to the demo of the Research Package, developed by the Copenhagen Center for Health Technology.",
                      textAlign: TextAlign.center,
                      style: TextStyle(fontSize: 16, color: Colors.white),
                    ),
                    Container(height: 5),
                    Text(
                      "If you have any questions feel free to contact us at",
                      textAlign: TextAlign.center,
                      style: TextStyle(fontSize: 16, color: Colors.white),
                    ),
                    Container(height: 5),
                    Text(
                      "cph_cachet@gmail.com",
                      textAlign: TextAlign.center,
                      style: TextStyle(
                          fontSize: 16,
                          color: Colors.white,
                          decoration: TextDecoration.underline),
                    ),
                    //Container(height: 50),
                  ],
                )),
            Padding(
                padding: const EdgeInsets.only(top: 20),
                child: Column(
                  children: <Widget>[
                    ElevatedButton(
                      style: ElevatedButton.styleFrom(
                        backgroundColor: Color(0xffC32C39),
                        fixedSize: const Size(300, 60),
                      ),
                      child: Text(
                        locale?.translate("informed_consent") ??
                            "Informed Consent",
                        style: TextStyle(fontSize: 18),
                      ),
                      onPressed: () {
                        Navigator.of(context).push(MaterialPageRoute<dynamic>(
                            builder: (context) => InformedConsentPage()));
                      },
                    ),
                    Container(height: 10),
                    ElevatedButton(
                      style: ElevatedButton.styleFrom(
                        backgroundColor: Color(0xffC32C39),
                        fixedSize: const Size(300, 60),
                      ),
                      child: Text(
                        locale?.translate("linear_survey") ?? "Linear Survey",
                        style: TextStyle(fontSize: 18),
                      ),
                      onPressed: () {
                        Navigator.of(context).push(MaterialPageRoute<dynamic>(
                            builder: (context) => LinearSurveyPage()));
                      },
                    ),
                    Container(height: 10),
                    ElevatedButton(
                      style: ElevatedButton.styleFrom(
                        backgroundColor: Color(0xffC32C39),
                        fixedSize: const Size(300, 60),
                      ),
                      child: Text(
                        locale?.translate("branching_survey") ??
                            "Branching Survey",
                        style: TextStyle(fontSize: 18),
                      ),
                      onPressed: () {
                        Navigator.of(context).push(MaterialPageRoute<dynamic>(
                            builder: (context) => NavigableSurveyPage()));
                      },
                    ),
                  ],
                )),
          ],
        ),
      ),
      bottomNavigationBar: SafeArea(
          child: Padding(
        padding: const EdgeInsets.all(22.0),
        child: Image.asset(
          "assets/images/cachet-logo-white.png",
          height: 50,
        ),
      )),
    );
  }
}
27
likes
0
points
1.38k
downloads

Publisher

verified publishercachet.dk

Weekly Downloads

A Flutter framework for obtaining informed consent, showing surveys and collecting results.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

audiofileplayer, carp_serializable, flutter, json_annotation, rxdart, signature, simple_html_css

More

Packages that depend on research_package