123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'package:vnoteapp/components/dynamic_drawer.dart.dart';
- import 'package:vnoteapp/pages/home/controller.dart';
- import 'widgets/avatar.dart';
- import 'widgets/menus.dart';
- import 'widgets/navigator.dart';
- class HomePage extends GetView<HomeController> {
- const HomePage({super.key});
- @override
- Widget build(BuildContext context) {
- return SafeArea(
- top: false,
- bottom: false,
- right: false,
- left: false,
- // maintainBottomViewPadding: true,
- child: LayoutBuilder(
- builder: (context, c) {
- return Scaffold(
- key: controller.homeScaffoldKey,
- // resizeToAvoidBottomInset: false,
- backgroundColor: const Color.fromRGBO(238, 238, 238, 1),
- endDrawer: VDynamicDrawerWrapper(
- scaffoldKey: controller.homeScaffoldKey,
- ),
- body: Column(
- mainAxisSize: MainAxisSize.max,
- children: [
- SizedBox(
- height: 90,
- child: _buildHeader(context),
- ),
- const SizedBox(height: 2),
- // Expanded(child: _buildBody(context)),
- SizedBox(
- height: c.maxHeight - 90 - 2,
- child: _buildBody(context),
- ),
- ],
- ),
- );
- },
- ),
- );
- }
- Widget _buildBody(BuildContext context) {
- final menuScrollController = ScrollController();
- return Row(
- mainAxisSize: MainAxisSize.max,
- children: [
- Container(
- width: 120,
- // color: const Color.fromRGBO(34, 164, 211, 1),
- color: Theme.of(context).primaryColor.withOpacity(.8),
- child: Stack(
- children: [
- Positioned(
- bottom: 0,
- left: 0,
- right: 0,
- child: Opacity(
- opacity: 0.5,
- child: Image.asset(
- "assets/images/e_hospital.png",
- fit: BoxFit.fitWidth,
- ),
- ),
- ),
- Column(
- mainAxisSize: MainAxisSize.max,
- children: [
- Expanded(
- child: Obx(
- () {
- return HomeMenuListViewWidget(
- source: controller.state.menuItems,
- scrollerController: menuScrollController,
- );
- },
- ),
- ),
- ],
- ),
- ],
- ),
- ),
- Expanded(child: _buildContent()),
- ],
- );
- }
- Widget _buildContent() {
- return Padding(
- padding: EdgeInsets.all(8),
- child: HomeNavigator(),
- // child: Container(
- // color: Colors.white,
- // child: HomeNavigator(),
- // ),
- );
- }
- Widget _buildHeader(BuildContext context) {
- final themeData = Theme.of(context);
- return Container(
- alignment: Alignment.center,
- padding: const EdgeInsets.symmetric(horizontal: 20),
- decoration: BoxDecoration(
- gradient: LinearGradient(
- colors: [
- // Color.fromRGBO(59, 188, 255, 1),
- // Color.fromRGBO(44, 120, 229, 1),
- themeData.primaryColor.withOpacity(.6),
- themeData.primaryColor,
- ],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- ),
- ),
- child: Center(
- child: Row(
- mainAxisSize: MainAxisSize.max,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Expanded(
- child: Align(
- alignment: Alignment.centerLeft,
- child: _buildHeaderLeft(),
- ),
- ),
- Align(
- alignment: Alignment.center,
- child: _buildHeaderCenter(),
- ),
- const Spacer(),
- // Expanded(
- // child: Align(
- // alignment: Alignment.centerRight,
- // child: _buildHeaderRight(),
- // ),
- // ),
- ],
- ),
- ),
- );
- }
- Widget _buildHeaderLeft() {
- return Row(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- const HomeAvatarWidget(size: 50),
- const SizedBox(width: 16),
- Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- controller.state.doctorName,
- style: const TextStyle(
- color: Colors.white,
- fontSize: 20,
- fontWeight: FontWeight.bold,
- ),
- ),
- Text(
- controller.state.doctorTeamName,
- style: const TextStyle(
- color: Color.fromRGBO(208, 208, 208, 1),
- fontSize: 16,
- ),
- ),
- ],
- )
- ],
- );
- }
- Widget _buildHeaderCenter() {
- return Row(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Image.asset(
- "assets/images/vinno_logo2.png",
- height: 40,
- fit: BoxFit.fitHeight,
- ),
- const SizedBox(width: 8),
- const Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- SizedBox(height: 8),
- Text(
- "智慧家医平台",
- style: TextStyle(
- color: Colors.white,
- fontSize: 20,
- ),
- ),
- ],
- ),
- ],
- );
- }
- Widget _buildHeaderRight() {
- return Image.asset(
- "assets/images/iflyrobot.png",
- height: 80,
- fit: BoxFit.fitHeight,
- );
- }
- }
|