drawerHeader method

dynamic drawerHeader(
  1. String? title,
  2. String? subTitle,
  3. String? imagePath,
  4. Color? circleColor, {
  5. TemplateRF? template,
  6. BuildContext? context,
})

Implementation

drawerHeader(
  String? title,
  String? subTitle,
  String? imagePath,
  Color? circleColor, {
  TemplateRF? template,
  BuildContext? context,
}) {
  var modernHeader = Container(
    width: 250,
    child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
          Text(title!, style: WidgetStyleRF.theme.appTitle(template)),
          TextRF(
            subTitle ?? '',
            style: WidgetStyleRF.theme.appSubTitle(template)!,
          )
        ]),
  );

  var modernOvalHeader = Column(
    crossAxisAlignment: CrossAxisAlignment.stretch,
    children: <Widget>[
      Container(
        color: Colors.transparent,
        height: 240,
        padding: EdgeInsets.only(top: 15),
        child: Container(
          padding: EdgeInsets.zero,
          child: Stack(
            alignment: AlignmentDirectional.center,
            children: <Widget>[
              Positioned(
                child: FaIcon(FontAwesomeIcons.powerOff, color: Colors.red),
                right: 50,
                top: 10,
              ),
              Positioned(
                  top: 30.0,
                  left: 105,
                  child: Column(
                    children: <Widget>[
                      SizedBox(height: 20),
                      CircleAvatar(
                        radius: 55,
                        backgroundColor: Colors.redAccent,
                        child: CircleAvatar(
                          radius: 50,
                          backgroundImage: AssetImage(imagePath!), //
                        ),
                      ),
                      Padding(
                        padding: EdgeInsets.only(top: 5),
                        child: Text(
                          title,
                          style: TextStyle(
                            fontWeight: FontWeight.bold,
                            color: Colors.black,
                            fontSize: 18,
                          ),
                        ),
                      ),
                      Padding(
                        padding: const EdgeInsets.only(top: 0),
                        child: Text(
                          subTitle ?? '',
                          style: TextStyle(color: Colors.black),
                        ),
                      ),
                    ],
                  )),
            ],
          ),
        ),
      )
    ],
  );

  var materialHeader = Container(
    height: 250,
    color: Colors.blue,
    alignment: Alignment(0, 0),
    child: Column(
      children: <Widget>[
        SizedBox(height: 60),
        CircleAvatar(
          radius: 55,
          backgroundColor: Colors.redAccent,
          child: CircleAvatar(
            radius: 50, backgroundImage: AssetImage(imagePath), //
          ),
        ),
        SizedBox(height: 10),
        Text(
          title,
          style: WidgetStyleRF.theme
              .pageTitle(TemplateRF(null, style: WidgetStyleRF(textColor: Colors.white))),
        ),
        //.theme.pageTitle()
        Text(
          subTitle ?? '',
          style: WidgetStyleRF.theme.pageSubTitle(
            TemplateRF(null, style: WidgetStyleRF(textColor: Colors.white, fontSize: 16)),
          ),
        )
      ],
    ),
  );

  template = TemplateRF.get(template!);
  if (template!.name == TemplateNameRF.modern && template.version == 'Oval')
    return modernOvalHeader;
  else if (template.name == TemplateNameRF.modern)
    return modernHeader;
  else if (template.name == TemplateNameRF.material) return materialHeader;
}