common_title.dart 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:hengyi/config/config.dart';
  4. import 'package:hengyi/utils/common_util.dart';
  5. class CommonTitleWidget extends StatelessWidget {
  6. CommonTitleWidget({super.key});
  7. var textSize = 0.0;
  8. var sizeHeight = 0.0;
  9. var logoWidth = 0.0;
  10. @override
  11. Widget build(BuildContext context) {
  12. if(Util.isWeb()){
  13. textSize = 60.sp;
  14. sizeHeight = 200.h;
  15. logoWidth = 80.h;
  16. }else{
  17. textSize = 80.sp;
  18. sizeHeight = 240.h;
  19. logoWidth = 100.h;
  20. }
  21. return SizedBox(
  22. width: MediaQuery.of(context).size.width,
  23. height: sizeHeight,
  24. child: Row(
  25. mainAxisAlignment: MainAxisAlignment.center,
  26. children: [
  27. Image(
  28. image: const AssetImage("images/logo.png"),
  29. width: logoWidth,
  30. height: logoWidth,
  31. ),
  32. Container(
  33. margin: const EdgeInsets.only(left: 10),
  34. child: Text(
  35. AppConfig.configWebName,
  36. style: TextStyle(
  37. color: Colors.black,
  38. fontSize: textSize,
  39. fontWeight: FontWeight.bold),
  40. ),
  41. )
  42. ],
  43. ),
  44. );
  45. }
  46. }