view.dart 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. import 'package:flutter/material.dart';
  2. import 'package:get/get.dart';
  3. import 'package:vitalapp/components/dynamic_drawer.dart';
  4. import 'package:vitalapp/pages/home/controller.dart';
  5. import 'package:vitalapp/pages/home/widgets/avatar.dart';
  6. import 'package:fis_common/helpers/color.dart';
  7. import 'widgets/menus.dart';
  8. import 'widgets/navigator.dart';
  9. class HomePage extends GetView<HomeController> {
  10. const HomePage({super.key});
  11. @override
  12. Widget build(BuildContext context) {
  13. return SafeArea(
  14. top: false,
  15. bottom: false,
  16. right: false,
  17. left: false,
  18. // maintainBottomViewPadding: true,
  19. child: LayoutBuilder(
  20. builder: (context, c) {
  21. return WillPopScope(
  22. onWillPop: () async {
  23. return false;
  24. },
  25. child: Scaffold(
  26. key: controller.homeScaffoldKey,
  27. // resizeToAvoidBottomInset: false,
  28. backgroundColor: const Color.fromRGBO(238, 238, 238, 1),
  29. endDrawer: VDynamicDrawerWrapper(
  30. scaffoldKey: controller.homeScaffoldKey,
  31. ),
  32. body: Row(
  33. mainAxisSize: MainAxisSize.max,
  34. children: [
  35. // Expanded(child: _buildBody(context)),
  36. SizedBox(
  37. width: c.maxWidth,
  38. child: _buildBody(context),
  39. ),
  40. ],
  41. ),
  42. ),
  43. );
  44. },
  45. ),
  46. );
  47. }
  48. Widget _buildBody(BuildContext context) {
  49. final menuScrollController = ScrollController();
  50. return Row(
  51. mainAxisSize: MainAxisSize.max,
  52. children: [
  53. Container(
  54. width: 120,
  55. // color: const Color.fromRGBO(10, 32, 48, .8),
  56. decoration: BoxDecoration(
  57. gradient: LinearGradient(
  58. colors: [
  59. // Color.fromRGBO(59, 188, 255, 1),
  60. // Color.fromRGBO(44, 120, 229, 1),
  61. Theme.of(context).primaryColor,
  62. FColorHelper.mixColor(
  63. Colors.black, Theme.of(context).primaryColor, 50),
  64. ],
  65. begin: Alignment.bottomRight,
  66. end: Alignment.topLeft,
  67. ),
  68. ),
  69. child: Stack(
  70. children: [
  71. Positioned(
  72. bottom: 0,
  73. left: 0,
  74. right: 0,
  75. child: Opacity(
  76. opacity: 0.5,
  77. child: Image.asset(
  78. "assets/images/e_hospital.png",
  79. fit: BoxFit.fitWidth,
  80. ),
  81. ),
  82. ),
  83. Column(
  84. mainAxisSize: MainAxisSize.max,
  85. children: [
  86. SizedBox(
  87. height: 90,
  88. child: Column(
  89. mainAxisAlignment: MainAxisAlignment.center,
  90. children: [
  91. Obx(
  92. () => HomeAvatarWidget(
  93. size: 40,
  94. headImageToken: controller.state.headImageToken,
  95. ),
  96. ),
  97. const SizedBox(
  98. height: 8,
  99. ),
  100. Obx(
  101. () => Text(
  102. controller.state.doctorName,
  103. style: const TextStyle(
  104. color: Colors.white,
  105. fontSize: 16,
  106. ),
  107. ),
  108. ),
  109. ],
  110. ),
  111. ),
  112. Divider(
  113. color: Colors.white.withOpacity(.4),
  114. height: 1,
  115. indent: 30,
  116. endIndent: 30,
  117. ),
  118. const SizedBox(
  119. height: 8,
  120. ),
  121. Expanded(
  122. child: Obx(
  123. () {
  124. return HomeMenuListViewWidget(
  125. source: controller.state.menuItems,
  126. scrollerController: menuScrollController,
  127. );
  128. },
  129. ),
  130. ),
  131. ],
  132. ),
  133. ],
  134. ),
  135. ),
  136. Container(
  137. color: Theme.of(context).primaryColor,
  138. child: VerticalDivider(
  139. width: 1,
  140. color: Colors.white.withOpacity(.4),
  141. ),
  142. ),
  143. Expanded(
  144. child: Column(
  145. children: [
  146. SizedBox(
  147. height: 60,
  148. child: _buildHeader(context),
  149. ),
  150. Expanded(
  151. child: Row(
  152. children: [
  153. Expanded(
  154. child: _buildContent(),
  155. ),
  156. ],
  157. ),
  158. ),
  159. ],
  160. )),
  161. ],
  162. );
  163. }
  164. Widget _buildContent() {
  165. return const Padding(
  166. padding: EdgeInsets.all(8),
  167. child: HomeNavigator(),
  168. // child: Container(
  169. // color: Colors.white,
  170. // child: HomeNavigator(),
  171. // ),
  172. );
  173. }
  174. Widget _buildHeader(BuildContext context) {
  175. final themeData = Theme.of(context);
  176. return Container(
  177. alignment: Alignment.center,
  178. decoration: BoxDecoration(
  179. gradient: LinearGradient(
  180. colors: [
  181. // Color.fromRGBO(59, 188, 255, 1),
  182. // Color.fromRGBO(44, 120, 229, 1),
  183. themeData.primaryColor.withOpacity(.6),
  184. themeData.primaryColor,
  185. ],
  186. begin: Alignment.topRight,
  187. end: Alignment.bottomLeft,
  188. ),
  189. ),
  190. child: Center(
  191. child: Row(
  192. mainAxisSize: MainAxisSize.max,
  193. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  194. children: [
  195. Expanded(
  196. child: Align(
  197. alignment: Alignment.centerLeft,
  198. child: _buildHeaderLeft(),
  199. ),
  200. ),
  201. Align(
  202. alignment: Alignment.center,
  203. child: _buildHeaderCenter(),
  204. ),
  205. const Spacer(),
  206. // Expanded(
  207. // child: Align(
  208. // alignment: Alignment.centerRight,
  209. // child: _buildHeaderRight(),
  210. // ),
  211. // ),
  212. ],
  213. ),
  214. ),
  215. );
  216. }
  217. Widget _buildHeaderLeft() {
  218. return Row(
  219. mainAxisSize: MainAxisSize.min,
  220. crossAxisAlignment: CrossAxisAlignment.center,
  221. children: [
  222. // const HomeAvatarWidget(size: 40),
  223. const SizedBox(width: 16),
  224. RichText(
  225. text: TextSpan(
  226. text: controller.state.doctorTeamName,
  227. style: const TextStyle(
  228. color: Colors.white,
  229. fontSize: 20,
  230. fontWeight: FontWeight.bold,
  231. ),
  232. // children: [
  233. // TextSpan(
  234. // text: '- ${controller.state.doctorName}',
  235. // style: const TextStyle(
  236. // color: Colors.white,
  237. // fontSize: 20,
  238. // ),
  239. // )
  240. // ],
  241. ),
  242. ),
  243. ],
  244. );
  245. }
  246. Widget _buildHeaderCenter() {
  247. return Row(
  248. mainAxisSize: MainAxisSize.min,
  249. crossAxisAlignment: CrossAxisAlignment.center,
  250. children: [
  251. // Image.asset(
  252. // "assets/images/vinno_logo2.png",
  253. // height: 35,
  254. // fit: BoxFit.fitHeight,
  255. // ),
  256. const SizedBox(width: 10),
  257. Column(
  258. mainAxisAlignment: MainAxisAlignment.center,
  259. children: const [
  260. // SizedBox(height: 8),
  261. Text(
  262. "家医健康系统",
  263. style: TextStyle(
  264. color: Colors.white,
  265. fontSize: 24,
  266. fontWeight: FontWeight.bold,
  267. ),
  268. ),
  269. ],
  270. ),
  271. ],
  272. );
  273. }
  274. Widget _buildHeaderRight() {
  275. return Image.asset(
  276. "assets/images/iflyrobot.png",
  277. height: 80,
  278. fit: BoxFit.fitHeight,
  279. );
  280. }
  281. }