import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; /// 样式工具类 class Styles { static double? buttonFontSize; static double? iconBigSize; static double? iconSize; static EdgeInsetsGeometry? primaryPadding; // Dart SDK >= 2.6 可简写 // ScreenUtil().setSp(10) -> 10.sp 适配字体 // ScreenUtil().setWidth(10) -> 10.w 根据屏幕宽度适配尺寸 // ScreenUtil().setHeight(10) -> 10.h 根据屏幕高度适配尺寸(一般根据宽度适配即可) // ScreenUtil().radius(10) -> 10.r 根据宽度或高度中的较小者进行调整 static void initSize() { buttonFontSize = 43.0.sp; iconBigSize = 58.0.sp; iconSize = ScreenUtil().radius(50.0); primaryPadding = EdgeInsets.only(left: 30.0.w, right: 30.0.w, bottom: 15.0.h); } static const primaryColor = Color(0xff484848); static const linkColor = Color(0xff4899ee); static final titleStyle = TextStyle( fontSize: 80.0.sp, fontWeight: FontWeight.w700, color: primaryColor); static final formLabelStyle = TextStyle( fontSize: 56.0.sp, fontWeight: FontWeight.w500, color: primaryColor); static final btnFontStyle = TextStyle( fontSize: buttonFontSize, fontWeight: FontWeight.normal, color: primaryColor); static final configDescStyle = TextStyle( fontSize: 48.sp, fontWeight: FontWeight.normal, color: primaryColor); static final drawerTileStyle = TextStyle( fontSize: 58.0.sp, fontWeight: FontWeight.w500, color: Styles.primaryColor); static final drawerTilePadding = EdgeInsets.fromLTRB( 70.0.w, 35.0.h, 0, 35.0.h); /// 状态栏设置 static const SystemUiOverlayStyle statusBarStyle = SystemUiOverlayStyle( systemNavigationBarColor: primaryColor, systemNavigationBarDividerColor: null, statusBarColor: Colors.transparent, systemNavigationBarIconBrightness: Brightness.light, statusBarIconBrightness: Brightness.dark, statusBarBrightness: Brightness.light, ); }