flutterresponsive

how to make flutter app font responsive for tablet?


**flutter app need to make responsive for tablet , how to write if ---------------------- size condition can u help me **

Widget build(BuildContext context) {
        var screenSize = MediaQuery.of(context).size;
        return WillPopScope(
          onWillPop: _onWillPop,
          child: Scaffold(
            backgroundColor: Constant.BLACK_COLOR,
            appBar: AppBar(
              centerTitle: true,


    ******this is my example code , i need to make bigger font only in tablet ******

i tried sizer but not working i m a fresher , help me if u know


Solution

  • You can use flutter_screenutil package

       Text(
         '16sp, will not change with the system.',
          style: TextStyle(
            color: Colors.black,
            fontSize: 16.sp, // this will make font responsive
          ),
        ),
    

    Or you can identify device type with below code

      static bool isMobile(BuildContext context) =>
          MediaQuery.of(context).size.width < 650;
    
      static bool isTablet(BuildContext context) =>
          MediaQuery.of(context).size.width < 1100 &&
          MediaQuery.of(context).size.width >= 650;
    
      static bool isDesktop(BuildContext context) =>
          MediaQuery.of(context).size.width >= 1100;