Commit 8922bcda authored by laishanqi's avatar laishanqi

提交药师端首页

parent 3d92996b
import 'package:flutter/material.dart';
import 'package:netrain_flutter_app/laishanqi/Images.dart';
class HomePage extends StatefulWidget {
@override
State createState() {
return _HomePage();
}
}
class _HomePage extends State {
var currentIndex = 0;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
bottomNavigationBar: BottomNavigationBar(
backgroundColor: Colors.white,
selectedFontSize: 10,
unselectedFontSize: 10,
currentIndex: currentIndex,
onTap: (index) {
setState(() {
currentIndex = index;
});
},
items: [
BottomNavigationBarItem(
activeIcon: Image.asset(Images.ic_home_selected),
icon: Image.asset(Images.ic_home_normal),
label: "处方列表"),
BottomNavigationBarItem(
activeIcon: Image.asset(Images.ic_my_selected),
icon: Image.asset(Images.ic_my_normal),
label: "我的"),
],
),
body: showBody(),
),
);
}
Widget showBody() {
if (currentIndex == 0) {
return home();
} else {
return my();
}
}
Widget home() {
return Container(
color: Color(0xfff8f8f8),
child: Column(
children: [
Container(
color: Colors.white,
alignment: Alignment.center,
padding: EdgeInsets.only(top: 33, bottom: 9),
child: Text(
"处方列表",
textAlign: TextAlign.center,
style: TextStyle(color: Color(0xff151515), fontSize: 16),
),
),
Container(
height: 1,
color: Color(0xfff1f1f1),
),
select(),
Expanded(
child: RefreshIndicator(
onRefresh: handleRefresh,
child: ListView.builder(
padding: EdgeInsets.all(0),
itemCount: 10,
itemBuilder: (BuildContext context, int index) {
return _item();
},
),
),
),
],
),
);
}
Widget _item() {
return Stack(
children: [
Container(
height: 128,
margin: EdgeInsets.only(left: 16, right: 16, bottom: 16),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(10)),
),
Positioned(right: 10, top: 10, child: Image.asset(Images.ic_state_01)),
Positioned(
top: 16,
left: 32,
child: Text(
"R001520041700004",
style: TextStyle(fontSize:16,color: Color(0xff151515)),
)),
Positioned(
top: 52,
left: 34,
right: 34,
child: Container(
height: 1,
color: Color(0xfff1f1f1),
),
),
Positioned(
top: 64,
left: 32,
child: Text("医生姓名:刘泽婷",style: TextStyle(fontSize: 16,color: Color(0xff171717)),)),
Positioned(
top: 92,
left: 32,
child: Text("处方时间:2020-04-17 15:3426",style: TextStyle(fontSize: 14,color: Color(0xff7D7D7D)),))
],
);
}
String text = "下拉刷新 ";
Future<String> handleRefresh() async {
text = "刷新中";
setState(() {});
await Future.delayed(Duration(milliseconds: 2000));
text = "刷新完成";
setState(() {});
return text;
}
var isSelectAll = false;
Widget select() {
TextStyle textStyle_01;
TextStyle textStyle_02;
BoxDecoration boxDecoration_01;
BoxDecoration boxDecoration_02;
// 选中全部
if (isSelectAll) {
textStyle_01 =
TextStyle(color: Colors.white, fontWeight: FontWeight.bold);
textStyle_02 =
TextStyle(color: Color(0xff7d7d7d), fontWeight: FontWeight.bold);
boxDecoration_01 = BoxDecoration(
borderRadius: BorderRadius.circular(6),
gradient: LinearGradient(colors: [
Color(0xff45DAFF),
Color(0xff3084FF),
]));
boxDecoration_02 = BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(6),
);
}
// 选中等待审核
else {
textStyle_02 =
TextStyle(color: Colors.white, fontWeight: FontWeight.bold);
textStyle_01 =
TextStyle(color: Color(0xff7d7d7d), fontWeight: FontWeight.bold);
boxDecoration_02 = BoxDecoration(
borderRadius: BorderRadius.circular(6),
gradient: LinearGradient(colors: [
Color(0xff45DAFF),
Color(0xff3084FF),
]));
boxDecoration_01 = BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(6),
);
}
List<Widget> items = [
Expanded(
flex: 1,
child: Container(
height: 29,
margin: EdgeInsets.all(6),
decoration: boxDecoration_01,
child: MaterialButton(
onPressed: () {
setState(() {
isSelectAll = true;
});
},
child: Text(
"等待审核",
style: textStyle_01,
),
),
),
),
Expanded(
flex: 1,
child: Container(
height: 29,
margin: EdgeInsets.all(6),
decoration: boxDecoration_02,
child: MaterialButton(
onPressed: () {
setState(() {
isSelectAll = false;
});
},
child: Text(
"全部",
style: textStyle_02,
),
),
),
),
];
return Container(
child: Container(
margin: EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(8)),
child: Row(
children: items,
),
),
);
}
Widget my() {
return Container(
decoration: BoxDecoration(color: Colors.yellow),
);
}
}
class Images{
static const imagesPath = "assets/images/";
static const ic_login_mode = "${imagesPath}ic_login_mode.png";
static const logo_01 = "${imagesPath}logo_01.png";
static const ic_home_normal = "${imagesPath}ic_home_normal.png";
static const ic_home_selected = "${imagesPath}ic_home_selected.png";
static const ic_my_normal = "${imagesPath}ic_my_normal.png";
static const ic_my_selected = "${imagesPath}ic_my_selected.png";
static const ic_state_01 = "${imagesPath}ic_state_01.png";
static const ic_state_02 = "${imagesPath}ic_state_02.png";
static const ic_state_03 = "${imagesPath}ic_state_03.png";
}
\ No newline at end of file
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'Cat.dart';
import 'layout_page.dart';
......@@ -101,9 +102,7 @@ class _StatefulGroupState extends State<FulGroupPage> {
)
: RefreshIndicator(
child: ListView(
children: <Widget>[
Text(text)
],
children: <Widget>[Text(text)],
),
onRefresh: handleRefresh,
),
......@@ -114,13 +113,11 @@ class _StatefulGroupState extends State<FulGroupPage> {
String text = "下拉刷新 ";
Future<String> handleRefresh() async {
text = "刷新中";
setState(() {
});
text = "刷新中";
setState(() {});
await Future.delayed(Duration(milliseconds: 2000));
text = "刷新完成";
setState(() {
});
text = "刷新完成";
setState(() {});
return text;
}
......@@ -132,9 +129,14 @@ class _StatefulGroupState extends State<FulGroupPage> {
return Container(
alignment: Alignment.center,
decoration: BoxDecoration(color: color),
child: Text(
title,
style: TextStyle(fontSize: 22, color: Colors.white),
child: GestureDetector(
onTap: () {
Fluttertoast.showToast(msg: null);
},
child: Text(
title,
style: TextStyle(fontSize: 22, color: Colors.white),
),
),
);
}
......
......@@ -24,7 +24,9 @@ class LessGroupPage extends StatelessWidget {
body: Container(
decoration: BoxDecoration(color: Colors.white),
alignment: Alignment.center,
child: Column(
child:
Column(
children: <Widget>[
Text("text!!!!"),
Icon(
......@@ -57,7 +59,15 @@ class LessGroupPage extends StatelessWidget {
AlertDialog(
title: Text('标题'),
content: Text('这里是内容'),
)
),
Expanded(child: ListView.builder(
padding: new EdgeInsets.all(5.0),
itemCount: 50,
itemExtent: 50,
itemBuilder: (BuildContext context,int index){
return new Text("text $index");
},
),)
],
),
),
......
......@@ -32,13 +32,50 @@ class _LayoutGroupState extends State<LayoutPage> {
children: [
Row(
children: [
ClipOval(
//圆形裁剪
child: SizedBox(
width: 100,
height: 100,
child: Image.network(
'http://pix2.tvzhe.com/thumb/star/60/87/260x346.jpg'),
Container(
height: 30,
width: 120,
margin: EdgeInsets.all(10),
decoration: BoxDecoration(boxShadow: [
BoxShadow(
offset: Offset(0, 10),
blurRadius: 15,
spreadRadius: -5)
]),
child: RaisedButton(
child: Text("按钮"),
onPressed: () {},
)),
Container(
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
boxShadow: [
BoxShadow(
offset: Offset(0, 10),
blurRadius: 15,
spreadRadius: -5)
]),
child: ClipOval(
//圆形裁剪
child: Container(
height: 120,
width: 120,
constraints:
BoxConstraints(maxHeight: 100, maxWidth: 100),
foregroundDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
border: Border.all(
color: Colors.red,
width: 2,
style: BorderStyle.solid)),
child: Image.network(
'http://pix2.tvzhe.com/thumb/star/60/87/260x346.jpg',
height: 100,
width: 100,
fit: BoxFit.cover,
),
),
),
),
Padding(
......
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:netrain_flutter_app/laishanqi/HomePage.dart';
import 'package:netrain_flutter_app/laishanqi/Images.dart';
/// 登录页
class LoginPage extends StatefulWidget {
......@@ -30,7 +32,7 @@ class _LoginState extends State<LoginPage> {
// logo
Container(
margin: EdgeInsets.only(top: 108),
child: Image.asset("assets/images/logo_01.png"),
child: Image.asset(Images.logo_01),
),
// 验证码登录按钮 和 账号密码登录按钮
Container(
......@@ -70,6 +72,8 @@ class _LoginState extends State<LoginPage> {
Fluttertoast.showToast(msg: "验证码或密码不能为空");
return;
}
// 跳转
Navigator.push(context, MaterialPageRoute(builder: (context)=>HomePage()));
Fluttertoast.showToast(
msg:
"登录 手机号:${phoneController.text} 验证码或密码:${codeController.text}");
......@@ -179,7 +183,7 @@ class _LoginState extends State<LoginPage> {
var currentStyle02;
var image = Container(
margin: EdgeInsets.only(top: 5),
child: Image.asset("assets/images/ic_login_mode.png"),
child: Image.asset(Images.ic_login_mode),
);
if (select == 1) {
......
......@@ -48,8 +48,8 @@ flutter:
# To add assets to your application, add an assets section, like this:
assets:
- assets/images/logo_01.png
- assets/images/ic_login_mode.png
- assets/images/
# - assets/images/ic_login_mode.png
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
......
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