import 'package:app_hit_a_wod/src/blocs/stats.bloc.dart';
import 'package:app_hit_a_wod/src/providers/api.provider.dart';
import 'package:app_hit_a_wod/src/providers/auth.provider.dart';
import 'package:app_hit_a_wod/src/providers/user-subscriptions.provider.dart';
import 'package:app_hit_a_wod/src/styles.dart';
import 'package:app_hit_a_wod/src/utils.dart';
import 'package:app_hit_a_wod/src/utils/fontello/my_flutter_app_icons.dart';
import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
import 'package:provider/provider.dart';
import 'package:rxdart/rxdart.dart';


class TrainingWorkoutFilterPage extends StatelessWidget {
  Widget build(BuildContext context) {
    final _api = Provider.of<ApiProvider>(context);
    final auth = Provider.of<AuthProvider>(context);
    final UserSubscriptionsProvider us_provider = Provider.of<UserSubscriptionsProvider>(context);
    final StatsBloc bloc = StatsBloc(
      context: context, 
      user_id: auth.currentUser.id,
      box_id: us_provider.currentActiveSubscription.box.id, 
    );
    Map<String, dynamic> arguments = ModalRoute.of(context).settings.arguments;
    final exerciseTypes = ["Abdominal","Pull-up","Static","Bike","Burpee","Jumps","Muscle-up","Cleans","Jerk","Presses","Lunges","Thruster","Climb","Curl","Deadlift","Dip","Hyperextension","Push","Jump Rope","Squat","Walking","Snatch","Push-up","Racks","Strongman","Rest","Row","Run","Swimming","Swing","Throw"];

    return neuScaffoldDetail(
      context: context,
      leading: IconButton(
        icon: Icon(Icons.arrow_back, color: Colors.transparent),
        onPressed: () {
          bloc.refreshWorkouts(auth.currentUser.id, arguments['name']);
          Navigator.of(context).pop();
        }
      ),
      title: Text("Filtros Workout", style: Theme.of(context).textTheme.subhead.copyWith(fontWeight: FontWeight.w500, fontSize: 18)),
      action: FlatButton(
        child: Text("Filtrar", style: Theme.of(context).textTheme.body1.copyWith(color: colors['primary']),),
        onPressed: () {
          bloc.refreshWorkouts(auth.currentUser.id, arguments['name']);
          Navigator.of(context).pop();
        }
      ),
      
      body: SingleChildScrollView(
        padding: EdgeInsets.all(20),
        child: Container (
          child: Column (
            children: <Widget> [
              Container(
                width: double.infinity,
                child: Expanded(
                  child: neuButton(
                    NeumorphicButton(
                      boxShape: NeumorphicBoxShape.roundRect(BorderRadius.circular(50)),
                      padding: EdgeInsets.all(15),
                      style: NeumorphicStyle(
                        color: Colors.transparent,
                        depth: neuDepth,
                      ),
                      child: Wrap(
                        crossAxisAlignment: WrapCrossAlignment.center,
                        children: <Widget>[
                          Text('Limpiar filtros y volver', style: TextStyle(color: colors['primary'])),
                          Icon(Icons.settings_backup_restore, color: colors['primary'],size: 15.0),
                        ],
                        spacing: 5,
                        runSpacing: 5,
                        alignment: WrapAlignment.center
                      ),
                      onClick: () {
                        bloc.cleanFiltersWorkout();
                        bloc.refreshWorkouts(auth.currentUser.id, arguments['name']);
                        Navigator.of(context).pop();
                      }
                    ),
                    width: 10,
                    colors: generateGradient(235, 235, 235),
                    borderRadius: BorderRadius.circular(30),
                  ),
                ),
              ),
              SizedBox(height: 20),
              StreamBuilder( //llistar tarifes
                  stream: CombineLatestStream.combine4(bloc.secondsWorkoutStream, bloc.difficultyWorkoutStream, bloc.categoryWorkoutStream, bloc.favoriteWorkoutStream, (a, b, c, d) => {"seconds": a, "difficulty": b, "category": c, "favorite": d}),
                  builder: (context, AsyncSnapshot data) {
                    if(bloc.categories!=null) {
                      return timeDifficulty(context, bloc);
                    } else {
                      return SizedBox();
                    }
                  }
              ),
              StreamBuilder(
                stream: bloc.sectionsWorkoutStream,
                builder: (BuildContext context, AsyncSnapshot<dynamic> data) {
                  if(data.hasData && bloc.allSections!=null) {
                    return Column(
                      children: <Widget>[
                        titleHeader("Tipo"),
                        Container(
                          padding: EdgeInsets.all(5.0),
                          child: Column(
                            children: new List.generate(bloc.allSections.length, (i)=>_secciones(bloc,bloc.allSections[i])),
                          ),
                        ),
                      ],
                    );
                  } else {
                    return SizedBox();
                  }
                }
              ),
              SizedBox(height: 20.0,),
              StreamBuilder(
                stream: bloc.equipmentWorkoutStream,
                builder: (BuildContext context, AsyncSnapshot<dynamic> data) {
                  return _buttonsMaterial(context, bloc, bloc.equipmentWorkoutValue);
                }
              ),
              SizedBox(height: 20.0,),
              StreamBuilder(
                stream: bloc.exerciseTypesWorkoutStream,
                builder: (BuildContext context, AsyncSnapshot<dynamic> data) {
                  if(data.hasData && exerciseTypes!=null) {
                    return Column(
                      children: <Widget>[
                        titleHeader("Tipo de ejercicios"),
                        Row(
                          children: <Widget>[
                            Expanded(child: SizedBox(),),
                            neuButton(
                              NeumorphicButton(
                                boxShape: NeumorphicBoxShape.roundRect(BorderRadius.circular(30)),
                                padding: EdgeInsets.symmetric(vertical: 10, horizontal: 30),
                                style: NeumorphicStyle(
                                  color: Colors.transparent,
                                  depth: neuDepth,
                                ),
                                child: Wrap(
                                  crossAxisAlignment: WrapCrossAlignment.center,
                                  alignment: WrapAlignment.center,
                                  children: <Widget>[
                                    Text('${bloc.exerciseTypesWorkoutValue.length<=0 ? 'Marcar todo' : 'Desmarcar todos'}', style: TextStyle(color: colors['primary'])),
                                    Icon(bloc.exerciseTypesWorkoutValue.length<=0 ? MyFlutterApp.ok : MyFlutterApp.cross, color: colors['primary'],size: 15.0)
                                  ],
                                  spacing: 5,
                                  runSpacing: 5,
                                ),
                                onClick: () {
                                  if (bloc.exerciseTypesWorkoutValue.length>0) {
                                    bloc.exerciseTypesWorkoutSet([]);
                                  } else {
                                    bloc.exerciseTypesWorkoutSet(["Abdominal","Pull-up","Static","Bike","Burpee","Jumps","Muscle-up","Cleans","Jerk","Presses","Lunges","Thruster","Climb","Curl","Deadlift","Dip","Hyperextension","Push","Jump Rope","Squat","Walking","Snatch","Push-up","Racks","Strongman","Rest","Row","Run","Swimming","Swing","Throw"]);
                                  }
                                  //Navigator.pushNamed(context, 'training-workout-detail', arguments: tw);
                                }
                              ),
                              colors: generateGradient(235, 235, 235),
                              borderRadius: BorderRadius.circular(30),
                            )
                          ],
                        ),
                        SizedBox(height: 20.0,),
                        Container(
                          width: double.infinity,
                          padding: EdgeInsets.all(5.0),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.start,
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: <Widget>[
                              Expanded(
                                child: Column(
                                  children: new List.generate((exerciseTypes.length/2).toInt(), (i)=>_exerciseTypes(context, bloc,exerciseTypes[i])),
                                ),
                              ),
                              Expanded(
                                child: Column(
                                  children: new List.generate(exerciseTypes.length-(exerciseTypes.length/2).toInt(), (i)=>_exerciseTypes(context, bloc,exerciseTypes[(exerciseTypes.length/2).toInt()+i])),
                                ),
                              ),
                            ],
                          ),
                        )                        
                      ],
                    );
                  } else {
                    return SizedBox();
                  }
                }
              ),
            ]
          )
        )
      )
    );
  }

  titleHeader(String title) {
    return Row(
      children: <Widget>[
        neuChip(Text("${title}", style: TextStyle(color: Colors.white),)),
        SizedBox(width: 20.0,),
        Expanded(
          child: Divider(color: colors['primary'],),
        ),
      ],
    );
  }

  timeDifficulty(BuildContext context, StatsBloc bloc) {
    List<String> diff = ['Fácil', 'Medio', 'Difícil'];
    return Container(
      child: Column(
        children: <Widget>[
          titleHeader("Tiempo y dificultad"),
          SizedBox(height: 20.0),
          Container(
            width: double.infinity,
            child: Wrap(
              crossAxisAlignment: WrapCrossAlignment.start,
              alignment: WrapAlignment.spaceBetween,
              children: <Widget>[
                Wrap(
                  spacing: 10.0,
                  runSpacing: 10.0,
                  crossAxisAlignment: WrapCrossAlignment.start,
                  alignment: WrapAlignment.center,
                  direction: Axis.vertical,
                  children: <Widget>[
                    Text('Tiempo máximo', style: Theme.of(context).textTheme.body1,),
                    neuTimeEntry(
                      context,
                      child: Text('${bloc.secondsWorkoutValue!= null ? UtilsHAW.dateToCronoTime(new DateTime.utc(2020,01,01,0,0,0,0,0).add(new Duration(seconds: bloc.secondsWorkoutValue))) : '--:--:--'}'),
                      onConfirm: (date) {
                        List<String> time = UtilsHAW.dateToCronoTime(date).split(':');
                        bloc.secondsWorkoutSet(int.parse(time[0])*3600+int.parse(time[1])*60+int.parse(time[2]));
                      },
                      onCancel: () {
                        bloc.secondsWorkoutSet(null);
                      },
                      width: 180
                    ),
                  ],
                ),
                Wrap(
                  spacing: 10.0,
                  runSpacing: 10.0,
                  crossAxisAlignment: WrapCrossAlignment.start,
                  alignment: WrapAlignment.center,
                  direction: Axis.vertical,
                  children: <Widget>[
                    Text('Dificultad máxima', style: Theme.of(context).textTheme.body1,),
                    neuContainer(
                      DropdownButton<String>(
                        hint: Text("Selecciona un nivel"),
                        value: diff[bloc.difficultyWorkoutValue-1],
                        isExpanded: true,
                        icon: Icon(Icons.arrow_drop_down, color: colors['primary'],),
                        underline: Container(height: 0, width: 0,),
                        items: <String>['Fácil', 'Medio', 'Difícil'].map((String value) {
                          return new DropdownMenuItem<String>(
                            value: value,
                            child: new Text("   "+value),
                          );
                        }).toList(),
                        onChanged: (value) {
                          bloc.difficultyWorkoutSet(diff.indexOf(value)+1);
                        },
                      ),
                      width: 150,
                      padding: EdgeInsets.all(2.0),
                    )
                  ],
                )

              ],
            ),
          ),
          Container(
            width: double.infinity,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                SizedBox(height: 20.0,),
                Text('Categoria', style: Theme.of(context).textTheme.body1,),
                SizedBox(height: 20.0,),
                neuContainer(
                  DropdownButton<String>(
                    hint: Text("   Selecciona una categoria"),
                    value: bloc.categoryWorkoutValue,
                    isExpanded: true,
                    icon: Icon(Icons.arrow_drop_down, color: colors['primary'],),
                    underline: Container(height: 0, width: 0,),
                    items: bloc.categories.map((String value) {
                      return new DropdownMenuItem<String>(
                        value: value,
                        child: new Text("   "+value),
                      );
                    }).toList(),
                    onChanged: (value) {
                      bloc.categoryWorkoutSet(value);
                    },
                  ),
                  width: double.infinity,
                  padding: EdgeInsets.all(6.0)
                )
              ],
            ),
          ),
          SizedBox(height: 20.0,),
          Container(
            width: double.infinity,
            child: Container(
              padding: EdgeInsets.symmetric(vertical: 5.0),
              child: Row(
                children: <Widget>[
                  NeumorphicCheckbox(
                    value: bloc.favoriteWorkoutValue==1 ? true : false,
                    style: neuCheckboxStyle(),
                    onChanged: (value) {
                      bloc.favoriteWorkoutSet(value ? 1 : 0);
                    }
                  ),
                  SizedBox(width: 10.0,),
                  Text("Mostrar solo favoritos", style: Theme.of(context).textTheme.body1.copyWith(fontSize: 15.0), overflow: TextOverflow.ellipsis,)
                ],
              ),
            ),
          ),
          SizedBox(height: 20.0,),
        ],
      ),
    );
  }

  _exerciseTypes(BuildContext context, StatsBloc bloc, String exercise) {
    return Container(
      padding: EdgeInsets.symmetric(vertical: 5.0),
      child: Row(
        children: <Widget>[
          NeumorphicCheckbox(
            value: bloc.exerciseTypesWorkoutValue.contains(exercise),
            style: neuCheckboxStyle(),
            onChanged: (val) {
              List<String> s = bloc.exerciseTypesWorkoutValue;
              if(s.contains(exercise)) s.remove(exercise);
              else s.add(exercise);
              bloc.exerciseTypesWorkoutSet(s);
            }
          ),
          SizedBox(width: 10.0,),
          Text("${exercise}", style: Theme.of(context).textTheme.body1.copyWith(fontSize: 15.0), overflow: TextOverflow.ellipsis,)
        ],
      ),
    );
  }

  _secciones(StatsBloc bloc, String section) {
    return Container(
      width: double.infinity,
      padding: EdgeInsets.symmetric(vertical: 5.0),
      child: Row(
        children: <Widget>[
          NeumorphicCheckbox(
            value: bloc.sectionsWorkoutValue.contains(section),
            style: neuCheckboxStyle(),
            onChanged: (val) {
              List<String> s = bloc.sectionsWorkoutValue;
              if(s.contains(section)) s.remove(section);
              else s.add(section);
              bloc.sectionsWorkoutSet(s);
            }
          ),
          SizedBox(width: 10.0,),
          Text("${section}", overflow: TextOverflow.ellipsis,)
        ],
      ),
    );
  }

  _buttonContent(Widget icon,Text text) {
    return Container(
      child: Column(
        children: <Widget>[
          icon,
          SizedBox(height: 10.0,),
          Container(
            alignment: Alignment.center,
            width: double.infinity,
            height: 30,
            child: text
          )
        ],
      ),
    );
  }

  _buttonMaterial(BuildContext context, StatsBloc bloc, List<String> equipment_workout, String titulo, String elemento, Widget icon) {
    return neuButton (
      NeumorphicButton(
        padding: EdgeInsets.all(10),
        style: equipment_workout.contains(elemento) ? neuStylePressed() : neuButtonStyle(),
        boxShape: neuBoxShape(),
        child: _buttonContent(icon,Text("${titulo}", style: Theme.of(context).textTheme.body1.copyWith(fontSize: 13.0, color: equipment_workout.contains(elemento) ? colors['primary'] : Color(0xFF575F6B)), overflow: TextOverflow.fade, textAlign: TextAlign.center,)),
        onClick: () {
          List<String> e = equipment_workout;
          if(e.contains(elemento)) e.remove(elemento);
          else e.add(elemento);
          bloc.equipmentWorkoutSet(e);
        },
      ),
    );
  }

  _buttonsMaterial(BuildContext context, StatsBloc bloc, List<String> equipment_workout) {
    return Column(
      children: <Widget>[
        titleHeader("Material"),
        Row(
          children: <Widget>[
            Expanded(child: SizedBox(),),
            neuButton(
              NeumorphicButton(
                boxShape: NeumorphicBoxShape.roundRect(BorderRadius.circular(30)),
                padding: EdgeInsets.symmetric(vertical: 10, horizontal: 30),
                style: NeumorphicStyle(
                  color: Colors.transparent,
                  depth: neuDepth,
                ),
                child: Wrap(
                  crossAxisAlignment: WrapCrossAlignment.center,
                  children: <Widget>[
                    Text('${bloc.equipmentWorkoutValue.length<=0 ? 'Marcar todo' : 'Desmarcar todos'}', style: TextStyle(color: colors['primary'])),
                    Icon(bloc.equipmentWorkoutValue.length<=0 ? MyFlutterApp.ok : MyFlutterApp.cross, color: colors['primary'],size: 15.0)
                  ],
                  spacing: 5,
                  runSpacing: 5,
                  alignment: WrapAlignment.center
                ),
                onClick: () {
                  if (bloc.equipmentWorkoutValue.length>0) {
                    bloc.equipmentWorkoutSet([]);
                  } else {
                    bloc.equipmentWorkoutSet(["Barbell","Barbell plate","Parallettes/Parallel bars","Bench","Racks","Dumbbell","Battle rope","Bicycle","Box jumps","Climbing rope","Dips","GHD","Gymnastic rings","Pull-up bar","Hammer","Kettlebell","Log","Medicine Ball","Rower","SandBag","Skipping rope","Sled","Stone","Swimming Pool","Tire","Vest"]);
                  }
                  //Navigator.pushNamed(context, 'training-workout-detail', arguments: tw);
                }
              ),
              colors: generateGradient(235, 235, 235),
              borderRadius: BorderRadius.circular(30),
            )
          ],
        ),
        SizedBox(height: 20.0,),
        Wrap(
          spacing: 20.0,
          runSpacing: 20.0,
          crossAxisAlignment: WrapCrossAlignment.center,
          alignment: WrapAlignment.spaceEvenly,
          children: <Widget>[
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Barbell",
                "Barbell",
                Icon(MyFlutterApp.barbell, size: 30.0, color: equipment_workout.contains("Barbell") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Platos",
                "Barbell plate",
                Icon(MyFlutterApp.barbellplate, size: 30.0, color: equipment_workout.contains("Barbell plate") ? colors['primary'] : Color(0xFF575F6B)))
              
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Paralelas",
                "Parallettes/Parallel bars",
                Icon(MyFlutterApp.parallettes, size: 30.0, color: equipment_workout.contains("Parallettes/Parallel bars") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Rack",
                "Racks",
                Icon(MyFlutterApp.racks, size: 30.0, color: equipment_workout.contains("Racks") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Press de Banca",
                "Bench",
                Icon(MyFlutterApp.bench_press, size: 30.0, color: equipment_workout.contains("Bench") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Dumbbell",
                "Dumbbell",
                Container(width: 30.0,height: 30.0,child: Icon(MyFlutterApp.dumbbell, size: 20.0, color: equipment_workout.contains("Dumbbell") ? colors['primary'] : Color(0xFF575F6B))))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Battle Rope",
                "Battle rope",
                Icon(MyFlutterApp.battlerope, size: 30.0, color: equipment_workout.contains("Battle rope") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Assault Bike",
                "Bicycle",
                Icon(MyFlutterApp.assaultbike, size: 30.0, color: equipment_workout.contains("Bicycle") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Cajón",
                "Box jumps",
                Icon(MyFlutterApp.boxjump, size: 30.0, color: equipment_workout.contains("Box jumps") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Rack Dips",
                "Dips",
                Icon(MyFlutterApp.dips, size: 30.0, color: equipment_workout.contains("Dips") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Cuerdad de escalada",
                "Climbing rope",
                Icon(MyFlutterApp.climbingrope, size: 30.0, color: equipment_workout.contains("Climbing rope") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"GHD",
                "GHD",
                Icon(MyFlutterApp.ghd, size: 30.0, color: equipment_workout.contains("GHD") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Rings",
                "Gymnastic rings",
                Icon(MyFlutterApp.rings, size: 30.0, color: equipment_workout.contains("Gymnastic rings") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Pull-up bar",
                "Pull-up bar",
                Icon(MyFlutterApp.dominadas, size: 30.0, color: equipment_workout.contains("Pull-up bar") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Hammer",
                "Hammer",
                Icon(MyFlutterApp.hammer, size: 30.0, color: equipment_workout.contains("Hammer") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Kettlebell",
                "Kettlebell",
                Icon(MyFlutterApp.kettlebell, size: 30.0, color: equipment_workout.contains("Kettlebell") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Medicine ball",
                "Medicine Ball",
                Icon(MyFlutterApp.medicineball, size: 30.0, color: equipment_workout.contains("Medicine Ball") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Remo",
                "Rower",
                Icon(MyFlutterApp.rower, size: 30.0, color: equipment_workout.contains("Rower") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"SandBag",
                "SandBag",
                Icon(MyFlutterApp.sandbag, size: 30.0, color: equipment_workout.contains("SandBag") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Cuerda",
                "Skipping rope",
                Icon(MyFlutterApp.rope, size: 30.0, color: equipment_workout.contains("Skipping rope") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Trineo",
                "Sled",
                Icon(MyFlutterApp.sled, size: 30.0, color: equipment_workout.contains("Sled") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Piedra",
                "Stone",
                Icon(MyFlutterApp.stone, size: 30.0, color: equipment_workout.contains("Stone") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Piscina",
                "Swimming Pool",
                Icon(MyFlutterApp.swimmingpool, size: 30.0, color: equipment_workout.contains("Swimming Pool") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Rueda",
                "Tire",
                Icon(MyFlutterApp.tire, size: 30.0, color: equipment_workout.contains("Tire") ? colors['primary'] : Color(0xFF575F6B)))
            ),
            Container (
              width: 90,
              height: 90,
              child: _buttonMaterial(context, bloc,equipment_workout,"Chaleco",
                "Vest",
                Icon(MyFlutterApp.vest, size: 30.0, color: equipment_workout.contains("Vest") ? colors['primary'] : Color(0xFF575F6B)))
            ),
          ],
        ),
      ],
    );
  }
}