Browse Source

feat : 企业详情界面

dev
徐振升 3 weeks ago
parent
commit
c8263858b8
  1. BIN
      assets/images/profile.png
  2. 10
      lib/app/features/enterprise/presentation/controllers/enterprise_list_controller.dart
  3. 86
      lib/app/features/enterprise/presentation/pages/enterprise_form_page.dart
  4. 88
      lib/app/features/enterprise/presentation/pages/enterprise_info_page.dart
  5. 15
      lib/app/features/enterprise/presentation/pages/enterprise_list_page.dart
  6. 9
      lib/app/routes/app_pages.dart
  7. 4
      lib/app/routes/app_routes.dart
  8. 2
      lib/modules/home/controllers/home_controller.dart
  9. 28
      lib/modules/my/views/my_page.dart
  10. 468
      lib/modules/test.dart

BIN
assets/images/profile.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

10
lib/app/features/enterprise/presentation/controllers/enterprise_list_controller.dart

@ -127,7 +127,15 @@ class EnterpriseListController extends GetxController {
///
Future<void> navigateToUploadPage() async {
final result = await Get.toNamed(AppRoutes.test);
// final result = await Get.toNamed(AppRoutes.test);
// if (result == true) {
// refreshList(); //
// }
}
///
Future<void> navigateToEnterpriseInfoPage() async {
final result = await Get.toNamed(AppRoutes.enterpriseInfo);
if (result == true) {
refreshList(); //
}

86
lib/app/features/enterprise/presentation/views/enterprise_form_page.dart → lib/app/features/enterprise/presentation/pages/enterprise_form_page.dart

@ -21,8 +21,9 @@ class EnterpriseFormPage extends GetView<EnterpriseFormController> {
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
child: Column(
children: [
buildTitleSection(title: '必填信息'),
SizedBox(height: 12.h),
_buildInfoSection(
title: '必填信息',
children: [
_buildTextField(
label: '企业名称',
@ -38,8 +39,9 @@ class EnterpriseFormPage extends GetView<EnterpriseFormController> {
],
),
SizedBox(height: 12.h),
buildTitleSection(title: '选填信息'),
SizedBox(height: 12.h),
_buildInfoSection(
title: '选填信息',
children: [
_buildTextField(
label: '企业地址',
@ -78,36 +80,57 @@ class EnterpriseFormPage extends GetView<EnterpriseFormController> {
// controller
PreferredSizeWidget _buildAppBar() {
return PreferredSize(
preferredSize: Size.fromHeight(56.h),
child: Container(
decoration: const BoxDecoration(
// ...
return AppBar(
// ... AppBar
// 使 Obx pageTitle
title: Obx(
() => Text(
controller.pageTitle.value,
style: TextStyle(
fontSize: 18.sp,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
child: AppBar(
// ... AppBar
// 使 Obx pageTitle
title: Obx(
() => Text(
controller.pageTitle.value,
style: TextStyle(
fontSize: 18.sp,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
leading: IconButton(
icon: Icon(
Icons.arrow_back_ios_new_rounded,
size: 24.sp,
color: Colors.white,
),
onPressed: () => Get.back(),
),
backgroundColor: Colors.transparent,
flexibleSpace: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF418CFC), Color(0xFF3DBFFC)],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
centerTitle: true,
),
),
elevation: 0,
centerTitle: true,
);
}
Widget buildTitleSection({required String title}) {
return Row(
children: [
Container(width: 4.w, height: 16.h, color: Colors.blue),
SizedBox(width: 8.w),
Text(
title,
style: TextStyle(fontSize: 16.sp, fontWeight: FontWeight.bold),
),
],
);
}
// ( "必填信息")
Widget _buildInfoSection({
required String title,
required List<Widget> children,
}) {
Widget _buildInfoSection({required List<Widget> children}) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
decoration: BoxDecoration(
@ -116,20 +139,7 @@ class EnterpriseFormPage extends GetView<EnterpriseFormController> {
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(width: 4.w, height: 16.h, color: Colors.blue),
SizedBox(width: 8.w),
Text(
title,
style: TextStyle(fontSize: 16.sp, fontWeight: FontWeight.bold),
),
],
),
SizedBox(height: 10.h),
...children,
],
children: [...children],
),
);
}

88
lib/app/features/enterprise/presentation/pages/enterprise_info_page.dart

@ -0,0 +1,88 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
//
class EnterpriseInfoPage extends StatelessWidget {
const EnterpriseInfoPage({super.key});
@override
Widget build(BuildContext context) {
// 1. 使 DefaultTabController Scaffold
// length: 2 Tab
return DefaultTabController(
length: 2,
child: Scaffold(
backgroundColor: const Color(0xFFF5F5F5), //
// 使 AppBar
appBar: _buildAlipayAppBar(context),
// TabBarView Tab
body: const TabBarView(
children: [
Center(child: Text('问题列表')),
Center(child: Text('企业基本信息')),
],
),
),
);
}
/// AppBar
PreferredSizeWidget _buildAlipayAppBar(BuildContext context) {
return AppBar(
// --- ---
backgroundColor: Colors.transparent, // AppBar
flexibleSpace: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF418CFC), Color(0xFF3DBFFC)],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
),
elevation: 0, // AppBar
systemOverlayStyle: SystemUiOverlayStyle.dark, //
// --- ---
leading: IconButton(
icon: const Icon(Icons.arrow_back_ios, color: Colors.white, size: 20),
onPressed: () {
Get.back();
},
),
// --- TabBar ---
// TabBar title 使
title: TabBar(
isScrollable: false, // true: Tab的宽度由内容决定; false:
labelColor: Colors.white, // Tab
unselectedLabelColor: Colors.grey, // Tab
// labelStyle: const TextStyle(fontSize: 17, fontWeight: FontWeight.bold),
// unselectedLabelStyle: const TextStyle(fontSize: 17),
overlayColor: WidgetStateProperty.all(Colors.transparent),
indicatorColor: Colors.white, //
// indicatorWeight: 2.5, //
indicatorPadding: EdgeInsetsGeometry.only(bottom: 4.h), // ),
indicatorSize: TabBarIndicatorSize.label, //
dividerHeight: 0, // TabBar 线
tabs: const [
Tab(text: '问题列表'),
Tab(text: '企业基本情况'),
],
),
centerTitle: false,
titleSpacing: 0,
// --- ---
actions: [
IconButton(
icon: Icon(Icons.add, color: Colors.white), // 使 .sp
onPressed: () {},
),
IconButton(
icon: Icon(Icons.upload, color: Colors.pink[300]), // 使 .sp
onPressed: () {},
),
],
);
}
}

15
lib/app/features/enterprise/presentation/views/enterprise_list_page.dart → lib/app/features/enterprise/presentation/pages/enterprise_list_page.dart

@ -20,7 +20,16 @@ class EnterpriseListPage extends GetView<EnterpriseListController> {
color: Colors.white,
),
),
backgroundColor: const Color(0xFF3B82F6),
backgroundColor: Colors.transparent,
flexibleSpace: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF418CFC), Color(0xFF3DBFFC)],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
),
elevation: 0,
centerTitle: true,
actions: [
@ -65,7 +74,9 @@ class EnterpriseListPage extends GetView<EnterpriseListController> {
onEdit: () {
controller.navigateToEditForm(enterprise);
},
onViewProblems: () {},
onViewProblems: () {
controller.navigateToEnterpriseInfoPage();
},
),
);
},

9
lib/app/routes/app_pages.dart

@ -1,6 +1,6 @@
import 'package:get/get.dart';
import 'package:problem_check_system/app/features/enterprise/presentation/bindings/enterprise_form_binding.dart';
import 'package:problem_check_system/app/features/enterprise/presentation/views/enterprise_form_page.dart';
import 'package:problem_check_system/app/features/enterprise/presentation/pages/enterprise_form_page.dart';
import 'package:problem_check_system/modules/home/bindings/home_binding.dart';
import 'package:problem_check_system/modules/home/views/home_page.dart';
import 'package:problem_check_system/modules/auth/bindings/login_binding.dart';
@ -10,7 +10,7 @@ import 'package:problem_check_system/modules/my/views/change_password.dart';
import 'package:problem_check_system/modules/problem/bindings/problem_form_binding.dart';
import 'package:problem_check_system/modules/problem/views/problem_form_page.dart';
import 'package:problem_check_system/modules/problem/views/problem_upload_page.dart';
import 'package:problem_check_system/modules/test.dart';
import 'package:problem_check_system/app/features/enterprise/presentation/pages/enterprise_info_page.dart';
import 'app_routes.dart';
@ -42,7 +42,10 @@ abstract class AppPages {
page: () => const ProblemFormPage(),
binding: ProblemFormBinding(),
),
GetPage(name: AppRoutes.test, page: () => const HealthApp()),
GetPage(
name: AppRoutes.enterpriseInfo,
page: () => const EnterpriseInfoPage(),
),
GetPage(
name: AppRoutes.enterpriseForm,
page: () => const EnterpriseFormPage(),

4
lib/app/routes/app_routes.dart

@ -13,10 +13,8 @@ abstract class AppRoutes {
// #endregion
// #region
static const enterprise = '/enterprise';
static const enterpriseInfo = '/enterpriseInfo';
static const enterpriseList = '/enterpriseList';
static const enterpriseForm = '/enterpriseForm';
// #endregion
static const test = '/test';
}

2
lib/modules/home/controllers/home_controller.dart

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:problem_check_system/app/features/enterprise/presentation/views/enterprise_list_page.dart';
import 'package:problem_check_system/app/features/enterprise/presentation/pages/enterprise_list_page.dart';
import 'package:problem_check_system/modules/my/views/my_page.dart';
import 'package:problem_check_system/modules/problem/views/problem_page.dart';

28
lib/modules/my/views/my_page.dart

@ -40,18 +40,13 @@ class MyPage extends GetView<MyController> {
///
Widget _buildBackground() {
return Positioned(
top: 0,
left: 0,
right: 0,
child: Container(
height: 250.h,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [const Color(0xFF418CFC), const Color(0x713DBFFC)],
),
return Container(
decoration: const BoxDecoration(
image: DecorationImage(
//
image: AssetImage('assets/images/profile.png'),
// 4. 使 BoxFit.cover
fit: BoxFit.cover,
),
),
);
@ -83,10 +78,10 @@ class MyPage extends GetView<MyController> {
padding: EdgeInsets.symmetric(horizontal: 20.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15.r),
borderRadius: BorderRadius.circular(10.r),
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 25.5),
color: Colors.grey.withValues(alpha: .5),
spreadRadius: 2,
blurRadius: 5,
offset: const Offset(0, 3),
@ -158,7 +153,10 @@ class MyPage extends GetView<MyController> {
),
Text(
controller.userPhone.value,
style: TextStyle(fontSize: 14.sp, color: Colors.grey),
style: TextStyle(
fontSize: 14.sp,
color: const Color(0xFF408EFC),
),
),
],
),

468
lib/modules/test.dart

@ -1,468 +0,0 @@
import 'package:flutter/material.dart';
class HealthApp extends StatelessWidget {
const HealthApp({super.key});
@override
Widget build(BuildContext context) {
return HomePage1();
}
}
class HomePage1 extends StatefulWidget {
const HomePage1({super.key});
@override
State<HomePage1> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage1>
with SingleTickerProviderStateMixin {
late TabController _tabController;
int _bottomNavIndex = 0;
@override
void initState() {
super.initState();
_tabController = TabController(length: 3, vsync: this);
}
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: _buildAppBar(),
body: SingleChildScrollView(
child: Column(
children: [
// _buildSearchBar(),
// _buildServicesGrid(),
const SizedBox(height: 12),
// _buildHealthManagementCard(),
const SizedBox(height: 12),
// _buildDoctorBanner(),
const SizedBox(height: 12),
// _buildPopularServices(),
],
),
),
// bottomNavigationBar: _buildBottomNavigationBar(),
);
}
// AppBar
PreferredSizeWidget _buildAppBar() {
return AppBar(
backgroundColor: Colors.blue,
elevation: 0,
leading: SizedBox(),
title: const Center(
child: Text(
'企业列表',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontFamily: 'MyFont',
),
),
),
actions: [
// IconButton(
// onPressed: () {},
// icon: const Icon(Icons.widgets_outlined, color: Colors.black),
// ),
IconButton(
onPressed: () {},
icon: const Icon(Icons.add, color: Colors.white),
),
],
bottom: TabBar(
controller: _tabController,
isScrollable: true,
labelColor: Colors.black,
unselectedLabelColor: Colors.grey[700],
indicatorColor: Colors.blue,
indicatorWeight: 3,
tabs: const [
Tab(text: '问题列表'),
Tab(text: '历史问题列表'),
Tab(text: '企业基本情况'),
],
),
);
}
// AppBar
PreferredSizeWidget _buildAppBar2() {
return AppBar(
backgroundColor: Colors.lightBlue[50],
elevation: 0,
leading: const Icon(Icons.arrow_back_ios, color: Colors.black),
title: const Center(
child: Text(
'企业列表',
style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
),
),
actions: [
// IconButton(
// onPressed: () {},
// icon: const Icon(Icons.widgets_outlined, color: Colors.black),
// ),
IconButton(
onPressed: () {},
icon: const Icon(Icons.add, color: Colors.black),
),
],
bottom: TabBar(
controller: _tabController,
isScrollable: true,
labelColor: Colors.black,
unselectedLabelColor: Colors.grey[700],
indicatorColor: Colors.blue,
indicatorWeight: 3,
tabs: const [
Tab(text: '问题列表'),
Tab(text: '历史问题列表'),
Tab(text: '企业基本情况'),
],
),
);
}
//
Widget _buildSearchBar() {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
color: Colors.lightBlue[50],
child: Row(
children: [
const Text('淄博', style: TextStyle(fontSize: 16)),
const Icon(Icons.arrow_drop_down),
const SizedBox(width: 8),
Expanded(
child: Container(
height: 40,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: const TextField(
decoration: InputDecoration(
hintText: '家庭共济',
prefixIcon: Icon(Icons.search, color: Colors.grey),
border: InputBorder.none,
contentPadding: EdgeInsets.symmetric(vertical: 10),
),
),
),
),
TextButton(
onPressed: () {},
child: const Text(
'搜索',
style: TextStyle(color: Colors.black, fontSize: 16),
),
),
],
),
);
}
//
Widget _buildServicesGrid() {
//
Widget buildGridItem(
IconData icon,
String label, {
bool isSpecial = false,
}) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Stack(
alignment: Alignment.topRight,
children: [
Icon(icon, size: 40, color: Colors.blue),
if (isSpecial)
Container(
padding: const EdgeInsets.symmetric(
horizontal: 4,
vertical: 1,
),
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(8),
),
child: const Text(
'正品药',
style: TextStyle(color: Colors.white, fontSize: 8),
),
),
],
),
const SizedBox(height: 8),
Text(label, style: const TextStyle(fontSize: 12)),
],
);
}
return Container(
color: Colors.lightBlue[50],
padding: const EdgeInsets.fromLTRB(16, 16, 16, 24),
child: GridView.count(
crossAxisCount: 5,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
children: [
buildGridItem(Icons.qr_code_scanner, '医保码'),
buildGridItem(Icons.add_box, '挂号'),
buildGridItem(Icons.person, '问诊'),
buildGridItem(Icons.medical_services, '买药', isSpecial: true),
buildGridItem(Icons.shield, '健康保障'),
buildGridItem(Icons.local_hospital, '好药源选'),
buildGridItem(Icons.health_and_safety, '体检'),
buildGridItem(Icons.mood, '口腔'),
buildGridItem(Icons.grass, '中医'),
buildGridItem(Icons.apps, '全部服务'),
],
),
);
}
//
Widget _buildHealthManagementCard() {
return Container(
margin: const EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'我的健康管理',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
const SizedBox(height: 12),
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.blue.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: Row(
children: [
const Icon(Icons.warning_amber_rounded, color: Colors.orange),
const SizedBox(width: 8),
const Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'你的补充医保待激活',
style: TextStyle(fontWeight: FontWeight.bold),
),
Text(
'√ 医保内外都能报 √ 带病投保首选',
style: TextStyle(color: Colors.grey, fontSize: 12),
),
],
),
),
ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.orange,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
),
),
child: const Text('去激活'),
),
],
),
),
],
),
);
}
//
Widget _buildDoctorBanner() {
return Container(
margin: const EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
image: const DecorationImage(
//
image: NetworkImage(
'https://img.tukuppt.com/png_preview/00/34/83/8fT4fFFaLg.jpg!/fw/780',
), // 使 URL
fit: BoxFit.cover,
alignment: Alignment.centerRight,
opacity: 0.8,
),
),
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'三甲医生快速问诊',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
SizedBox(height: 4),
Text('100%公立医生 不限制问诊次数', style: TextStyle(color: Colors.grey)),
],
),
// DecorationImage
],
),
);
}
//
Widget _buildPopularServices() {
return Container(
margin: const EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
),
child: Column(
children: [
const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'热门服务',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
Text('专病专科', style: TextStyle(color: Colors.grey)),
Text('健康百科', style: TextStyle(color: Colors.grey)),
Row(
children: [
Text('更多', style: TextStyle(color: Colors.grey)),
Icon(Icons.arrow_forward_ios, size: 12, color: Colors.grey),
],
),
],
),
const SizedBox(height: 16),
Row(
children: [
_buildServiceCard(
'百万医疗险',
'600万医疗保障',
Icons.add_to_photos,
Colors.blue,
),
const SizedBox(width: 12),
_buildServiceCard(
'百万住院保障',
'医保内外都可报',
Icons.security,
Colors.cyan,
),
],
),
const SizedBox(height: 12),
Row(
children: [
_buildServiceCard(
'医保种牙',
'种植牙方案科普',
Icons.mood,
Colors.lightBlue,
),
const SizedBox(width: 12),
_buildServiceCard(
'我的家',
'家人健康我守护',
Icons.home,
Colors.purpleAccent,
),
],
),
],
),
);
}
//
Widget _buildServiceCard(
String title,
String subtitle,
IconData icon,
Color color,
) {
return Expanded(
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: color.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(fontWeight: FontWeight.bold),
),
const SizedBox(height: 4),
Text(
subtitle,
style: const TextStyle(fontSize: 12, color: Colors.grey),
),
],
),
),
Icon(icon, color: color, size: 30),
],
),
),
);
}
//
Widget _buildBottomNavigationBar() {
return BottomNavigationBar(
currentIndex: _bottomNavIndex,
onTap: (index) {
setState(() {
_bottomNavIndex = index;
});
},
type: BottomNavigationBarType.fixed,
selectedItemColor: Colors.blue,
unselectedItemColor: Colors.grey,
items: const [
BottomNavigationBarItem(icon: Icon(Icons.home), label: '企业'),
BottomNavigationBarItem(
icon: Icon(Icons.card_membership),
label: '全部问题',
),
// BottomNavigationBarItem(icon: Icon(Icons.waves), label: 'AQ-健康管家'),
// BottomNavigationBarItem(icon: Icon(Icons.add_moderator), label: '医疗保障'),
BottomNavigationBarItem(icon: Icon(Icons.person_outline), label: '我的'),
],
);
}
}
Loading…
Cancel
Save