styles.dart 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/services.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. /// 样式工具类
  5. class Styles {
  6. static double? buttonFontSize;
  7. static double? iconBigSize;
  8. static double? iconSize;
  9. static EdgeInsetsGeometry? primaryPadding;
  10. // Dart SDK >= 2.6 可简写
  11. // ScreenUtil().setSp(10) -> 10.sp 适配字体
  12. // ScreenUtil().setWidth(10) -> 10.w 根据屏幕宽度适配尺寸
  13. // ScreenUtil().setHeight(10) -> 10.h 根据屏幕高度适配尺寸(一般根据宽度适配即可)
  14. // ScreenUtil().radius(10) -> 10.r 根据宽度或高度中的较小者进行调整
  15. static void initSize() {
  16. buttonFontSize = 43.0.sp;
  17. iconBigSize = 58.0.sp;
  18. iconSize = ScreenUtil().radius(50.0);
  19. primaryPadding =
  20. EdgeInsets.only(left: 30.0.w, right: 30.0.w, bottom: 15.0.h);
  21. }
  22. static const primaryColor = Color(0xff484848);
  23. static const linkColor = Color(0xff4899ee);
  24. static final titleStyle = TextStyle(
  25. fontSize: 80.0.sp,
  26. fontWeight: FontWeight.w700,
  27. color: primaryColor);
  28. static final formLabelStyle = TextStyle(
  29. fontSize: 56.0.sp,
  30. fontWeight: FontWeight.w500,
  31. color: primaryColor);
  32. static final btnFontStyle = TextStyle(
  33. fontSize: buttonFontSize,
  34. fontWeight: FontWeight.normal,
  35. color: primaryColor);
  36. static final configDescStyle = TextStyle(
  37. fontSize: 48.sp,
  38. fontWeight: FontWeight.normal,
  39. color: primaryColor);
  40. static final drawerTileStyle = TextStyle(
  41. fontSize: 58.0.sp,
  42. fontWeight: FontWeight.w500,
  43. color: Styles.primaryColor);
  44. static final drawerTilePadding = EdgeInsets.fromLTRB(
  45. 70.0.w,
  46. 35.0.h,
  47. 0,
  48. 35.0.h);
  49. /// 状态栏设置
  50. static const SystemUiOverlayStyle statusBarStyle = SystemUiOverlayStyle(
  51. systemNavigationBarColor: primaryColor,
  52. systemNavigationBarDividerColor: null,
  53. statusBarColor: Colors.transparent,
  54. systemNavigationBarIconBrightness: Brightness.light,
  55. statusBarIconBrightness: Brightness.dark,
  56. statusBarBrightness: Brightness.light,
  57. );
  58. }