Skip to content

type 'String' is not a subtype of type 'bool' #53160

@SobhieSaad

Description

@SobhieSaad

he relevant error-causing widget was:
Result file:/lib/ui/pages/home.dart:91:13
When the exception was thrown, this was the stack:
#0 SharedPreferences.getBool (package:shared_preferences/shared_preferences.dart:65:31)
#1 SharedPreferenceHelper.getBooleanFromSP (package:/helpers/shared_preference_helper.dart:30:55)
#2 Result.build (package:/ui/widgets/result_colored_circle_avatar.dart:23:49)
#3 StatelessElement.build (package:flutter/src/widgets/framework.dart:4291:28)
#4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4223:15)
...

`Widget dialogContent(BuildContext context) {
return Container(
margin: EdgeInsets.only(left: 0.0, right: 0.0),
child: Stack(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround ,

        children: <Widget>[
          Container(
            margin: EdgeInsets.only(top: 5.0, right: 5.0),
            decoration: BoxDecoration(
              color: Colors.white,
              shape: BoxShape.rectangle,
              borderRadius: BorderRadius.circular(16.0),
              boxShadow: <BoxShadow>[
                BoxShadow(
                  color: Colors.black26,
                  blurRadius: 0.0,
                  offset: Offset(0.0, 0.0),
                ),
              ],
            ),
            child: Padding(
              padding: const EdgeInsets.symmetric(horizontal: 15),
              child: Column(
                mainAxisSize: MainAxisSize.min,
                crossAxisAlignment: CrossAxisAlignment.stretch,
                children: <Widget>[
                  SizedBox(height: 15.0),

                  //=========UPPER value=======
                  Padding(
                    padding: const EdgeInsets.only(top: 15) ,
                    child: Row(
                      children: <Widget>[
                        Text(
                          'T'.tr,
                          style: TextStyle(
                            fontSize: 16.0,
                            fontWeight: FontWeight.bold,
                            color: black,
                          ),
                        ),

                        Text(
                          ' Core Body Temperature'.tr,
                          style: TextStyle(
                            fontSize: 14.0,
                            color: Colors.grey,
                          ),
                        ),
                        Spacer(),
                       /* GestureDetector(
                          onTap: (){DialogHelper.showAnimatedDialog(context,MyTabbedPage());},
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.end,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: <Widget>[
                              Padding(
                                padding: EdgeInsetsDirectional.only(start: 8 ),
                                child: Image.asset('assets/images/infoIcon.png' , height: 16, color: Colors.grey,),
                              ),
                            ],
                          ),
                        ),*/
                      ],
                    ),
                  ),

                  Row(
                    children: <Widget>[
                      Expanded(
                        child: TextField(
                          controller: controller1,

                        ),

                      ),
                      Padding(
                        padding: const EdgeInsets.only(left: 4, right: 4 ),
                        child: Text(
                          unitType,style: TextStyle(color: Colors.blue),
                        ),
                      ),
                      InkWell(
                        onTap: (){
                          setState(() {
                            counter++;
                            if(counter==2) {
                              unitType = "Celsius (C)";
                              temp_low_range=36.5;
                              temp_highrange=37.8;

                            }
                            else if(counter==3)
                            {
                              unitType="Fahrenheit (F)";
                              temp_low_range=97.7;
                              temp_highrange=100.04;


                            }
                          });
                        },
                        child: Image.asset('assets/images/biomarker_icons.png'),

                      ),
                    ],
                  ),



                  //=========== upper range ===============
                  Padding(
                    padding: const EdgeInsets.only(top: 5),
                    child: Row(
                      children: <Widget>[
                        Text(
                          'T'.tr,
                          style: TextStyle(
                            fontSize: 16.0,
                            fontWeight: FontWeight.bold,
                            color: black,
                          ),
                        ),

                        Text(
                          ' reference range'.tr,
                          style: TextStyle(
                            fontSize: 16.0,
                            color: Colors.grey,
                          ),
                        ),

                        GestureDetector(
                          onTap: (){DialogHelper.showAnimatedDialog(context, SettingPopup(title: titleReferenceRange,
                            description: contentReferenceRange_part1 + "\n\n"+ contentReferenceRange_part2+"\n\n"
                                + contentReferenceRange_part3,));},
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.start,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: <Widget>[
                              Padding(
                                padding: const EdgeInsets.only(left: 8),
                                child: Image.asset('assets/images/infoIcon.png' , height: 16, color: Colors.grey,),
                              ),

                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                  Row(
                    children: <Widget>[
                      Expanded(
                        child: TextField(
                          controller: controller2,
                          decoration: InputDecoration(
                            hintText:temp_low_range.toString(),
                          ),

                        ),
                      ),
                      Text(
                        " _ ",style: TextStyle(color: Colors.black26),
                      ),
                      Expanded(
                        child: TextField(
                          controller: controller3,
                          decoration: InputDecoration(
                            hintText:temp_highrange.toString(),
                          ),

                        ),
                      ),
                    ],
                  ),


                  //== DONE buttonn
                  SizedBox(height: 10),
                  Button(
                    'Done'.tr,
                    color: Colors.white,
                    backgroundColor: shadowColor,
                    tapBackgroundColor: Colors.white,
                    tapTextColor: shadowColor,
                    border: true,
                    onPressed: () {
                      if(controller1.text=="")
                        {
                          Navigator.pop(context);
                        }
                      else
                        {
                          Navigator.pop(context);
                        }


                    },
                    verticalPadding: 12,
                    borderRadius: 24,
                  ),

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    in triagePresently being triaged by the triage team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions