app_bar.dart 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import 'package:common_pub/common_pub.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:get/get.dart';
  4. import '../../generated/assets.dart';
  5. import 'home_controller.dart';
  6. class HomeAppBar extends GetView<HomeController>
  7. implements PreferredSizeWidget {
  8. const HomeAppBar({super.key, required this.tab});
  9. final Widget tab;
  10. @override
  11. Widget build(BuildContext context) {
  12. final statusBarHeight = MediaQuery.of(context).viewPadding.top;
  13. return SizedBox.expand(
  14. child: Container(
  15. padding: EdgeInsets.only(top: statusBarHeight),
  16. decoration: const BoxDecoration(
  17. image: DecorationImage(
  18. image: AssetImage(Assets.imagesBkCommonPage),
  19. fit: BoxFit.fitWidth),
  20. boxShadow: [
  21. BoxShadow(color: Color(0x33000000), spreadRadius: 4, blurRadius: 4)
  22. ]),
  23. child: Row(
  24. mainAxisSize: MainAxisSize.max,
  25. crossAxisAlignment: CrossAxisAlignment.center,
  26. children: [
  27. SizedBox(width: 660, height: double.infinity, child: tab),
  28. Expanded(
  29. child: Obx(() => controller.selectMapName.value.isEmpty
  30. ? const SizedBox()
  31. : Row(children: [
  32. Container(
  33. width: 10,
  34. height: 34,
  35. margin: const EdgeInsets.only(right: 12),
  36. decoration: BoxDecoration(
  37. color: Colors.blue,
  38. borderRadius: BorderRadius.circular(5)),
  39. ),
  40. Text(controller.selectMapName.value,
  41. style: const TextStyle(
  42. color: Colors.white, fontSize: 22))
  43. ]))),
  44. TextButton(
  45. onPressed: () {},
  46. child: const Row(
  47. crossAxisAlignment: CrossAxisAlignment.center,
  48. children: [
  49. Icon(Icons.radio, color: Colors.white),
  50. Text(' 广播',
  51. style: TextStyle(color: Colors.white, fontSize: 20))
  52. ],
  53. ))
  54. ],
  55. ),
  56. ));
  57. }
  58. @override
  59. Size get preferredSize => const Size.fromHeight(kToolbarHeight);
  60. }