tableDisplayer method Null safety

dynamic tableDisplayer(
  1. String title,
  2. Map tableData,
  3. BuildContext context
)

Returns a Column that contains a tableData to display. It has a title.

Implementation

static tableDisplayer(String title, Map tableData, BuildContext context) {
  Iterable columnTitles = tableData.keys;
  Iterable rows = tableData.values;
  return Column(
    children: [
      SizedBox(
        child: Container(
          height: Sizes.getPixelSize(0.0576435324, context),
          width: Sizes.getScreenSize(context).width*0.8,

          decoration: BoxDecoration(
            gradient: LinearGradient(
              begin: Alignment.centerLeft,
              end: Alignment.bottomRight,
              colors: CustomColors.displayInfo1()
            ),
            borderRadius: const BorderRadius.only(
              topLeft: Radius.circular(10),
              topRight: Radius.circular(10)
            ),
          ),
          child: Center(child: Text(title, style: Theme.of(context).textTheme.bodyText1,),)
        )
      ),
      SizedBox(
        child: Container(
          height: Sizes.getPixelSize(0.1152870649, context),
          width: Sizes.getScreenSize(context).width*0.8,

          decoration: BoxDecoration(
            gradient: LinearGradient(
                begin: Alignment.topCenter,
                end: Alignment.bottomCenter,
                colors: CustomColors.displayInfo2()
            ),
            borderRadius: const BorderRadius.only(
                bottomLeft: Radius.circular(10),
                bottomRight: Radius.circular(10)
            ),
          ),
          child: Center(
            child: Row(
              children: [
                SizedBox(
                  width: Sizes.getScreenSize(context).width*0.8*0.23,
                  child: Center(
                    child: Column(
                      children: [
                        SizedBox(height: Sizes.getPixelSize(0.01152870648, context)),
                        Text(columnTitles.elementAt(0), style: (Sizes.getScreenSize(context).width < 400) ? const TextStyle(fontSize: 12, fontWeight: FontWeight.w300, color: Colors.white) : Theme.of(context).textTheme.bodyText1,),
                        SizedBox(height: Sizes.getPixelSize(0.01152870648, context)),
                        Text(rows.elementAt(0), style: Theme.of(context).textTheme.bodyText1,),
                      ],
                    ),
                  )
                ),
                SizedBox(width: Sizes.getScreenSize(context).width*0.8*0.23,
                  child: Center(
                    child: Column(
                      children: [
                        SizedBox(height: Sizes.getPixelSize(0.01152870647, context)),
                        Text(columnTitles.elementAt(1), style: (Sizes.getScreenSize(context).width < 400) ? const TextStyle(fontSize: 12, fontWeight: FontWeight.w300, color: Colors.white) : Theme.of(context).textTheme.bodyText1,),
                        SizedBox(height: Sizes.getPixelSize(0.01152870649, context)),
                        Text(rows.elementAt(1), style: Theme.of(context).textTheme.bodyText1,),
                      ],
                    ),
                  ),),
                SizedBox(width: Sizes.getScreenSize(context).width*0.8*0.23,
                  child: Center(
                    child: Column(
                      children: [
                        SizedBox(height: Sizes.getPixelSize(0.01152870648, context)),
                        Text(columnTitles.elementAt(2), style: (Sizes.getScreenSize(context).width < 400) ? const TextStyle(fontSize: 12, fontWeight: FontWeight.w300, color: Colors.white) : Theme.of(context).textTheme.bodyText1,),
                        SizedBox(height: Sizes.getPixelSize(0.01152870648, context)),
                        Text(rows.elementAt(2), style: Theme.of(context).textTheme.bodyText1,),
                      ],
                    ),
                  ),),
                Expanded(child: SizedBox(
                    child: Center(
                      child: Column(
                        children: [
                          SizedBox(height: Sizes.getPixelSize(0.01152870648, context)),
                          Text(columnTitles.elementAt(3), style: (Sizes.getScreenSize(context).width < 400) ? const TextStyle(fontSize: 12, fontWeight: FontWeight.w300, color: Colors.white) : Theme.of(context).textTheme.bodyText1,),
                          SizedBox(height: Sizes.getPixelSize(0.01152870648, context)),
                          Text(rows.elementAt(3), style: Theme.of(context).textTheme.bodyText1,),
                        ],
                      ),
                    )
                )),
              ],
            )
          )
        )
      ),
    ]
  );
}