app_bar.dart 2.2 KB

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