Commit 43eec03d authored by laishanqi's avatar laishanqi

首页demo

parent 2a777710
......@@ -8,6 +8,7 @@ class AppColors{
static const hintText = 0xffb4b4b4;
/// 输入框字体颜色
static const EditTextColor = 0xff333333;
static const color_999 = 0xff999999;
/// 页面背景颜色
static const scaffoldBackgroundColor = 0xffffffff;
/// 分割线颜色
......
......@@ -27,5 +27,11 @@ class Images{
static const ic_bottom_03_true = "${imagesPath}nav_03_true.png";
static const ic_friend = "${imagesPath}ic_friend.png";
static const ic_prescription_home = "${imagesPath}ic_prescription_home.png";
static const ic_code = "${imagesPath}ic_code.png";
static const ic_more_white_little = "${imagesPath}ic_more_white_little.png";
static const img_home_pharmacy = "${imagesPath}img_home_pharmacy.png";
static const img_home_treatment = "${imagesPath}img_home_treatment.png";
static const ic_home_list = "${imagesPath}ic_home_list.png";
static const img_blank_nomessage = "${imagesPath}img_blank_nomessage.png";
}
\ No newline at end of file
import 'package:flustars/flustars.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:netrain_flutter_app/common/AppColors.dart';
import 'package:netrain_flutter_app/common/Images.dart';
class DoctorHomePage extends StatefulWidget {
@override
_DoctorHomePageState createState() => _DoctorHomePageState();
}
class _DoctorHomePageState extends State<DoctorHomePage>{
class _DoctorHomePageState extends State<DoctorHomePage> {
final _scrollController = ScrollController();
var isShowBlackTitle = false;
@override
void initState() {
super.initState();
_scrollController.addListener(() {
print("华东 ${_scrollController.offset}");
if (_scrollController.offset > 270 && !isShowBlackTitle) {
setState(() {
isShowBlackTitle = true;
});
} else if (_scrollController.offset < 270 && isShowBlackTitle) {
setState(() {
isShowBlackTitle = false;
});
}
});
}
@override
......@@ -20,6 +37,365 @@ class _DoctorHomePageState extends State<DoctorHomePage>{
@override
Widget build(BuildContext context) {
return Container();
return Scaffold(
body: CustomScrollView(
physics: BouncingScrollPhysics(),
controller: _scrollController,
slivers: [
SliverAppBar(
titleSpacing: 16,
toolbarHeight: 50,
automaticallyImplyLeading: false,
pinned: true,
floating: false,
flexibleSpace: FlexibleSpaceBar(
collapseMode: CollapseMode.pin,
background: Container(
color: Color(AppColors.mainColor),
child: Stack(
children: [
Positioned(
child: ClipOval(
//圆形裁剪
child: Container(
height: 56,
width: 56,
constraints:
BoxConstraints(maxHeight: 100, maxWidth: 100),
foregroundDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
border: Border.all(
color: Colors.white,
width: 2,
style: BorderStyle.solid)),
child: Image.network(
'http://pix2.tvzhe.com/thumb/star/60/87/260x346.jpg',
height: 56,
width: 56,
fit: BoxFit.cover,
),
),
),
top: 106,
left: 18,
),
Positioned(
child: Text(
"愚鱼余",
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold),
),
top: 106,
left: 82,
),
Positioned(
child: Text(
"主任医师",
style: TextStyle(color: Colors.white, fontSize: 12),
),
top: 111,
left: 144,
),
Positioned(
child: Container(
width: 68,
height: 20,
decoration: BoxDecoration(
color: Colors.white30,
borderRadius: BorderRadius.circular(10)),
child:
// Text(
// "主任医师",
// textAlign: TextAlign.center,
// style: TextStyle(
// backgroundColor: Colors.amber,
// color: Colors.white,
// fontSize: 11,
// ),
// ),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"主任医师",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 11,
),
),
Image.asset(Images.ic_more_white_little)
],
),
),
top: 138,
left: 82,
),
Positioned(
child: Image.asset(
Images.ic_code,
height: 30,
width: 30,
),
top: 117,
right: 16,
),
Positioned(
child: Container(
child: _getStatisticsView(),
width: ScreenUtil.getScreenW(context),
),
top: 185,
),
Positioned(
child: Container(
child: Flex(
direction: Axis.horizontal,
children: [
_getTab("药房续方", "12"),
_getTab("等待接诊", "10"),
],
),
width: ScreenUtil.getScreenW(context),
),
top: 253,
left: 8,
right: 8,
),
],
),
),
),
expandedHeight: 322,
title: Container(
child: Text(
"我的工作站",
style: TextStyle(
fontSize: 21,
fontWeight: FontWeight.bold,
color: isShowBlackTitle ? Colors.black : Colors.white),
),
),
),
SliverToBoxAdapter(
child: Container(
margin: EdgeInsets.only(top: 16, bottom: 16),
child: Wrap(
spacing: 8,
children: [
Image.asset(Images.ic_home_list),
Text(
"咨询列表",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(AppColors.EditTextColor),
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
),
_getChatList(),
],
),
);
}
List<String> list = List.generate(10, (index) => "马云 $index");
var showEmpty = false;
/// 咨询列表
Widget _getChatList() {
return list.isEmpty
? _getEmptyView()
: SliverList(
delegate:
SliverChildBuilderDelegate((BuildContext context, int index) {
return Dismissible(
background: Container(
alignment: Alignment.centerRight,
padding: EdgeInsets.only(right: 16),
color: Colors.red,
child: Text(
"删除",
style: TextStyle(color: Colors.white),
textAlign: TextAlign.center,
),
),
key: Key("${list[index]}"),
onDismissed: (direction) {
setState(() {
print(
"删除成功? ${list.remove(list[index])}, ${list.toString()}");
});
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text("删除了 $index")));
},
child: Container(
width: ScreenUtil.getScreenW(context),
height: 82,
child: Stack(
children: [
Positioned(
child: Image.asset(
Images.ic_doctor_avatar,
width: 50,
height: 50,
),
top: 16,
left: 5,
),
Positioned(
child: Text(
"${list[index]}",
style: TextStyle(
color: Color(AppColors.EditTextColor),
fontWeight: FontWeight.bold,
fontSize: 16),
),
top: 16,
left: 66,
),
Positioned(
width: ScreenUtil.getScreenW(context) * 0.7,
child: Text(
"感冒发烧流鼻涕,建议您多喝热水建议您多喝热水建议您多喝热水建议您多喝热水建议您多喝热",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(AppColors.color_999), fontSize: 14),
),
bottom: 18,
left: 66,
),
Positioned(
child: Text(
"刚刚",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(AppColors.hintText), fontSize: 12),
),
top: 16,
right: 16,
),
Positioned(
child: Container(
margin: EdgeInsets.only(left: 16, right: 16),
width: ScreenUtil.getScreenW(context) - 32,
height: 1,
color: Color(AppColors.dividerColor),
),
bottom: 0,
)
],
),
),
);
}, childCount: list.length));
}
/// 咨询列表的空数据视图
Widget _getEmptyView() {
return SliverList(
delegate: SliverChildListDelegate([
Image.asset(
Images.img_blank_nomessage,
fit: BoxFit.none,
),
Text(
"您暂时没有新消息",
style: TextStyle(
fontSize: 14,
color: Color(AppColors.text_default_color),
),
textAlign: TextAlign.center,
)
]));
}
/// 中间的医生统计数据
Widget _getStatisticsView() {
return Flex(
direction: Axis.horizontal,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: getStatisticsChild("123", "患者人数"),
flex: 1,
),
Expanded(
child: getStatisticsChild("537", "累计处方次数"),
flex: 1,
),
Expanded(
child: getStatisticsChild("189", "累计问诊次数"),
flex: 1,
),
// getStatisticsChild("537", "累计处方次数"),
// getStatisticsChild("189", "累计问诊次数"),
],
);
}
Column getStatisticsChild(String num, String name) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
num,
style: TextStyle(
color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold),
),
Text(
name,
style: TextStyle(color: Color(0xccffffff), fontSize: 11),
),
],
);
}
/// 药房续方和等待接诊
Widget _getTab(String name, String num) {
return Expanded(
flex: 1,
child: Container(
margin: EdgeInsets.only(left: 8, right: 8),
child: Stack(
children: [
Image.asset(Images.img_home_pharmacy),
Positioned(
child: Text(
name,
style: TextStyle(
color: Color(AppColors.mainColor),
fontSize: 14,
fontWeight: FontWeight.bold),
),
top: 10,
left: 10,
),
Positioned(
child: Text(
num,
style: TextStyle(
color: Color(AppColors.mainColor),
fontSize: 36,
fontWeight: FontWeight.bold),
),
bottom: 0,
left: 10,
),
],
),
),
);
}
}
......@@ -123,6 +123,7 @@ class _RegisterState extends State {
}
onRegisterClick() {
Navigator.pushNamed(context, "doctorHome");
if(_formKey.currentState.validate()){
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("请求注册")));
}
......
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:netrain_flutter_app/xuehao/BottomNavpage.dart';
import 'package:netrain_flutter_app/xuehao/car_details.dart';
......@@ -9,6 +10,7 @@ import 'package:netrain_flutter_app/xuehao/list_page.dart';
import 'laishanqi/Stateful_page.dart';
import 'laishanqi/Stateless_page.dart';
import 'laishanqi/layout_page.dart';
import 'laishanqi/netrain/DoctorHomePage.dart';
import 'laishanqi/netrain/user/loginPage.dart';
import 'laishanqi/netrain/user/RegisterPage.dart';
import 'laishanqi/photo.dart';
......@@ -35,6 +37,11 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
// 设置状态栏为透明
SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(statusBarColor:Colors.transparent);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
return WillPopScope(
child: MaterialApp(
title: 'Flutter Demo',
......@@ -63,8 +70,8 @@ class MyApp extends StatelessWidget {
"firstVC":(context) => jssPageDemo(),
"car_details":(context) =>CarDetailsPage(),
"student":(context) => jssPageDemo(),
"car_details":(context) =>CarDetailsPage(),
"grid_page":(context) =>GridPage(),
"doctorHome":(context) => DoctorHomePage(),
"bottom_page":(context) =>BottomNavPage(),
},
),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment