[flutter] 앱의 사이즈를 자동으로 맞춰주는 flutter_screenutil

Edward Hyun·2021년 11월 19일
0

app&web-dev

목록 보기
15/178
post-custom-banner

flutter_screenutil: ^5.0.0+2

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //Set the fit size (Find your UI design, look at the dimensions of the device screen and fill it in,unit in dp)
    return ScreenUtilInit(
      designSize: Size(360, 690),
      builder: () => MaterialApp(
        ...
        theme: ThemeData(
                          primarySwatch: Colors.blue,
                          textTheme: TextTheme(
                          //To support the following, you need to use the first initialization method
                            button: TextStyle(fontSize: 45.sp)
                          ),
                        ),
      ),
    );
  }
}

참고 :: https://pub.dev/packages/flutter_screenutil

profile
앱&웹개발(flutter, vuejs, typescript, react), 인공지능(nlp, asr, rl), 백엔드(nodejs, flask, golang, grpc, webrtc, aws, msa, nft, spring cloud, nest.js), 함수형 프로그래밍(scala, erlang)을 공부하며 정리합니다.
post-custom-banner

0개의 댓글