navi_bar.dart 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import 'dart:ui';
  2. import 'package:fast/extension/layout.dart';
  3. import 'package:fast/utils/size_fit.dart';
  4. import 'package:flutter/material.dart';
  5. // ignore: must_be_immutable
  6. class NaviBar extends StatelessWidget {
  7. String title = '';
  8. bool showInfo = false;
  9. bool showCalendarBar = false;
  10. VoidCallback closeCallback;
  11. NaviBar(
  12. {Key? key,
  13. required this.title,
  14. required this.closeCallback,
  15. bool? showInfo,
  16. bool? showBar})
  17. : super(key: key) {
  18. if (showInfo != null) {
  19. this.showInfo = showInfo;
  20. }
  21. if (showBar!=null){
  22. showCalendarBar = showBar;
  23. }
  24. }
  25. @override
  26. Widget build(BuildContext context) {
  27. EdgeInsets safePadding = MediaQuery.of(context).padding;
  28. double barHeight = 0.px;
  29. if (showCalendarBar==true){
  30. barHeight = 60.px;
  31. }
  32. return Stack(
  33. children: [
  34. ClipRect(
  35. child: BackdropFilter(
  36. filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
  37. child: Container(
  38. width: 375.px,
  39. height: 40.px+safePadding.top + barHeight,
  40. color: const Color(0xCC000D1F),
  41. )),
  42. ),
  43. Positioned(
  44. top: safePadding.top,
  45. child: Row(
  46. crossAxisAlignment: CrossAxisAlignment.center,
  47. children: [
  48. GestureDetector(
  49. onTap: () => closeCallback(),
  50. child: Image(
  51. image: AssetImage(showInfo
  52. ? 'assets/images/close.png'
  53. : 'assets/images/navi_back.png'),
  54. width: 20.px,
  55. height: 20.px,
  56. )
  57. .padding(left: 12.px, right: 12.px)
  58. .margin(left: 8.px, right: 20.px),
  59. ),
  60. Text(
  61. title,
  62. style: TextStyle(color: Colors.white, fontSize: 16.px),
  63. ),
  64. // if (showInfo)
  65. // GestureDetector(
  66. // child: Image(
  67. // image: const AssetImage('assets/images/info.png'),
  68. // width: 12.px,
  69. // height: 12.px,
  70. // ).paddingAll(6.px),
  71. // )
  72. ],
  73. ).height(40.px)),
  74. if (showCalendarBar==true)
  75. Positioned(
  76. left: 0,
  77. bottom: 6.px,
  78. child:
  79. Image.asset('assets/images/calendar_detail_top.png',width: 375.px,height: 48.px,)
  80. )
  81. ],
  82. );
  83. }
  84. }