Commit fd99e456 authored by laishanqi's avatar laishanqi

完善首页demo

parent 43eec03d
...@@ -33,5 +33,11 @@ class Images{ ...@@ -33,5 +33,11 @@ class Images{
static const img_home_treatment = "${imagesPath}img_home_treatment.png"; static const img_home_treatment = "${imagesPath}img_home_treatment.png";
static const ic_home_list = "${imagesPath}ic_home_list.png"; static const ic_home_list = "${imagesPath}ic_home_list.png";
static const img_blank_nomessage = "${imagesPath}img_blank_nomessage.png"; static const img_blank_nomessage = "${imagesPath}img_blank_nomessage.png";
static const tab_home_normal = "${imagesPath}tab_home_normal.png";
static const tab_home_selected = "${imagesPath}tab_home_selected.png";
static const tab_my_normal = "${imagesPath}tab_my_normal.png";
static const tab_my_selected = "${imagesPath}tab_my_selected.png";
static const tab_patient_normal = "${imagesPath}tab_patient_normal.png";
static const tab_patient_selected = "${imagesPath}tab_patient_selected.png";
} }
\ No newline at end of file
import 'package:flutter/material.dart';
import 'package:netrain_flutter_app/common/AppColors.dart';
import 'package:netrain_flutter_app/common/Images.dart';
import 'package:netrain_flutter_app/laishanqi/netrain/maintab/DoctorHomePage.dart';
class doctorMainPage extends StatefulWidget {
@override
_doctorMainPageState createState() {
return _doctorMainPageState();
}
}
class _doctorMainPageState extends State<doctorMainPage> {
var currentIndex = 0;
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: Container(
height: 50,
child: BottomNavigationBar(
backgroundColor: Colors.white,
selectedItemColor: Color(AppColors.mainColor),
unselectedItemColor: Color(AppColors.hintText),
selectedFontSize: 10,
unselectedFontSize: 10,
currentIndex: currentIndex,
onTap: (index) {
setState(() {
currentIndex = index;
});
},
items: [
BottomNavigationBarItem(
activeIcon: Image.asset(Images.tab_home_selected,width: 20,height: 20,),
icon: Image.asset(Images.tab_home_normal,width: 20,height: 20),
label: "首页"),
BottomNavigationBarItem(
activeIcon: Image.asset(Images.tab_patient_selected,width: 20,height: 20),
icon: Image.asset(Images.tab_patient_normal,width: 20,height: 20),
label: "患者"),
BottomNavigationBarItem(
activeIcon: Image.asset(Images.tab_my_selected,width: 20,height: 20),
icon: Image.asset(Images.tab_my_normal,width: 20,height: 20),
label: "我的"),
],
),
),
body: showBody(),
);
}
Widget showBody() {
if (currentIndex == 0) {
return DoctorHomePage();
} else if (currentIndex == 1) {
return Text("222");
} else {
return Text("33333");
}
}
}
...@@ -105,26 +105,16 @@ class _DoctorHomePageState extends State<DoctorHomePage> { ...@@ -105,26 +105,16 @@ class _DoctorHomePageState extends State<DoctorHomePage> {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white30, color: Colors.white30,
borderRadius: BorderRadius.circular(10)), borderRadius: BorderRadius.circular(10)),
child: child: Row(
// Text(
// "主任医师",
// textAlign: TextAlign.center,
// style: TextStyle(
// backgroundColor: Colors.amber,
// color: Colors.white,
// fontSize: 11,
// ),
// ),
Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( Text(
"主任医师", "浏览主页",
textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
height: 1.1,
color: Colors.white, color: Colors.white,
fontSize: 11, fontSize: 11
), ),
), ),
Image.asset(Images.ic_more_white_little) Image.asset(Images.ic_more_white_little)
...@@ -228,7 +218,6 @@ class _DoctorHomePageState extends State<DoctorHomePage> { ...@@ -228,7 +218,6 @@ class _DoctorHomePageState extends State<DoctorHomePage> {
), ),
key: Key("${list[index]}"), key: Key("${list[index]}"),
onDismissed: (direction) { onDismissed: (direction) {
setState(() { setState(() {
print( print(
"删除成功? ${list.remove(list[index])}, ${list.toString()}"); "删除成功? ${list.remove(list[index])}, ${list.toString()}");
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:netrain_flutter_app/common/AppColors.dart'; import 'package:netrain_flutter_app/common/AppColors.dart';
import 'package:netrain_flutter_app/douwen/dwMain.dart';
/** /**
* 注册页 * 注册页
...@@ -123,7 +122,7 @@ class _RegisterState extends State { ...@@ -123,7 +122,7 @@ class _RegisterState extends State {
} }
onRegisterClick() { onRegisterClick() {
Navigator.pushNamed(context, "doctorHome"); Navigator.pushNamed(context, "doctor_MainPage");
if(_formKey.currentState.validate()){ if(_formKey.currentState.validate()){
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("请求注册"))); ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("请求注册")));
} }
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
import 'package:netrain_flutter_app/xuehao/BottomNavpage.dart'; import 'package:netrain_flutter_app/xuehao/BottomNavpage.dart';
import 'package:netrain_flutter_app/xuehao/car_details.dart'; import 'package:netrain_flutter_app/xuehao/car_details.dart';
...@@ -10,7 +11,8 @@ import 'package:netrain_flutter_app/xuehao/list_page.dart'; ...@@ -10,7 +11,8 @@ import 'package:netrain_flutter_app/xuehao/list_page.dart';
import 'laishanqi/Stateful_page.dart'; import 'laishanqi/Stateful_page.dart';
import 'laishanqi/Stateless_page.dart'; import 'laishanqi/Stateless_page.dart';
import 'laishanqi/layout_page.dart'; import 'laishanqi/layout_page.dart';
import 'laishanqi/netrain/DoctorHomePage.dart'; import 'laishanqi/netrain/DoctorMain.dart';
import 'laishanqi/netrain/maintab/DoctorHomePage.dart';
import 'laishanqi/netrain/user/loginPage.dart'; import 'laishanqi/netrain/user/loginPage.dart';
import 'laishanqi/netrain/user/RegisterPage.dart'; import 'laishanqi/netrain/user/RegisterPage.dart';
import 'laishanqi/photo.dart'; import 'laishanqi/photo.dart';
...@@ -23,8 +25,6 @@ import 'zhangfeng/LayoutDemo.dart'; ...@@ -23,8 +25,6 @@ import 'zhangfeng/LayoutDemo.dart';
import 'jishuaishuai/firstVC.dart'; import 'jishuaishuai/firstVC.dart';
void main() { void main() {
runApp(MyApp()); runApp(MyApp());
// runApp(Login()); // runApp(Login());
...@@ -33,13 +33,14 @@ void main() { ...@@ -33,13 +33,14 @@ void main() {
print("启动"); print("启动");
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
// This widget is the root of your application. // This widget is the root of your application.
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// 设置状态栏为透明 // 设置状态栏为透明
SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(statusBarColor:Colors.transparent); SystemUiOverlayStyle systemUiOverlayStyle =
SystemUiOverlayStyle(statusBarColor: Colors.transparent);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
return WillPopScope( return WillPopScope(
...@@ -54,6 +55,15 @@ class MyApp extends StatelessWidget { ...@@ -54,6 +55,15 @@ class MyApp extends StatelessWidget {
scaffoldBackgroundColor: Color(AppColors.scaffoldBackgroundColor), scaffoldBackgroundColor: Color(AppColors.scaffoldBackgroundColor),
visualDensity: VisualDensity.adaptivePlatformDensity, visualDensity: VisualDensity.adaptivePlatformDensity,
), ),
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
const Locale('zh', 'CN'),
const Locale('en', 'US'),
],
routes: <String, WidgetBuilder>{ routes: <String, WidgetBuilder>{
"less": (context) => LessGroupPage(), "less": (context) => LessGroupPage(),
"ful": (context) => FulGroupPage(), "ful": (context) => FulGroupPage(),
...@@ -61,29 +71,29 @@ class MyApp extends StatelessWidget { ...@@ -61,29 +71,29 @@ class MyApp extends StatelessWidget {
"photo": (context) => PhotoApp(), "photo": (context) => PhotoApp(),
"register": (context) => RegisterPage(), "register": (context) => RegisterPage(),
"login": (context) => LoginPage(), "login": (context) => LoginPage(),
"listPage":(context) => List_Page(), "listPage": (context) => List_Page(),
"CustomTabPage":(context) => TabBarPage(), "CustomTabPage": (context) => TabBarPage(),
"LoginRequestPage":(context) => LoginRequestPage(), "LoginRequestPage": (context) => LoginRequestPage(),
"PageView":(context) => SampleAppPage(), "PageView": (context) => SampleAppPage(),
"LayoutDemo":(context) => LayoutDemo(), "LayoutDemo": (context) => LayoutDemo(),
"main": (context) => mainPage(), "main": (context) => mainPage(),
"firstVC":(context) => jssPageDemo(), "firstVC": (context) => jssPageDemo(),
"car_details":(context) =>CarDetailsPage(), "car_details": (context) => CarDetailsPage(),
"student":(context) => jssPageDemo(), "student": (context) => jssPageDemo(),
"grid_page":(context) =>GridPage(), "grid_page": (context) => GridPage(),
"doctorHome":(context) => DoctorHomePage(), "doctorHome": (context) => DoctorHomePage(),
"bottom_page":(context) =>BottomNavPage(), "bottom_page": (context) => BottomNavPage(),
"doctor_MainPage": (context) => doctorMainPage(),
}, },
), ),
onWillPop: () async { onWillPop: () async {
Fluttertoast.showToast(msg: "退出"); Fluttertoast.showToast(msg: "退出");
return true; return true;
}); });
} }
} }
Widget mainPage(){
Widget mainPage() {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text("路由"), title: Text("路由"),
...@@ -106,7 +116,10 @@ class _RouterNavigatorState extends State<RouterNavigator> { ...@@ -106,7 +116,10 @@ class _RouterNavigatorState extends State<RouterNavigator> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
child: Column( child: Container(
margin: EdgeInsets.only(left: 10,right: 10),
child: Wrap(
spacing: 10,
children: [ children: [
SwitchListTile( SwitchListTile(
title: Text('${byName ? '' : '不'}通过路由名跳转'), title: Text('${byName ? '' : '不'}通过路由名跳转'),
...@@ -116,22 +129,24 @@ class _RouterNavigatorState extends State<RouterNavigator> { ...@@ -116,22 +129,24 @@ class _RouterNavigatorState extends State<RouterNavigator> {
byName = value; byName = value;
}); });
}), }),
_item("首页", LessGroupPage(), 'doctor_MainPage'),
_item("less页面", LessGroupPage(), 'less'), _item("less页面", LessGroupPage(), 'less'),
_item("ful页面", FulGroupPage(), 'ful'), _item("ful页面", FulGroupPage(), 'ful'),
_item("layout页面", LayoutPage(), 'layout'), _item("layout页面", LayoutPage(), 'layout'),
_item("拍照页面", PhotoApp(), 'photo'), _item("拍照页面", PhotoApp(), 'photo'),
_item("登陆", LoginPage(), 'login'), _item("登陆", LoginPage(), 'login'),
_item("登录网络请求", LoginRequestPage(), 'LoginRequestPage'), _item("登录网络请求", LoginRequestPage(), 'LoginRequestPage'),
_item("CustomTabPage",TabBarPage(),'CustomTabPage'), _item("CustomTabPage", TabBarPage(), 'CustomTabPage'),
_item("PageView",SampleAppPage(),'PageView'), _item("PageView", SampleAppPage(), 'PageView'),
_item("LayoutDemo", LayoutDemo(), 'LayoutDemo'), _item("LayoutDemo", LayoutDemo(), 'LayoutDemo'),
_item("listview页面",List_Page(),'listPage'), _item("listview页面", List_Page(), 'listPage'),
_item("jssDemo", jssPageDemo(), 'firstVC'), _item("jssDemo", jssPageDemo(), 'firstVC'),
_item("jssDemo", jssPageDemo(), 'student'), _item("jssDemo", jssPageDemo(), 'student'),
_item("gridView",GridPage(),'grid_page'), _item("gridView", GridPage(), 'grid_page'),
_item("BottomNav",BottomNavPage(),'bottom_page'), _item("BottomNav", BottomNavPage(), 'bottom_page'),
], ],
), ),
),
); );
} }
...@@ -142,7 +157,11 @@ class _RouterNavigatorState extends State<RouterNavigator> { ...@@ -142,7 +157,11 @@ class _RouterNavigatorState extends State<RouterNavigator> {
if (byName) { if (byName) {
Navigator.pushNamed(context, routeName); Navigator.pushNamed(context, routeName);
} else { } else {
Navigator.push(context,MaterialPageRoute(builder: (context) => page,)); Navigator.push(
context,
MaterialPageRoute(
builder: (context) => page,
));
} }
}, },
child: Text(title), child: Text(title),
...@@ -150,4 +169,3 @@ class _RouterNavigatorState extends State<RouterNavigator> { ...@@ -150,4 +169,3 @@ class _RouterNavigatorState extends State<RouterNavigator> {
); );
} }
} }
...@@ -24,6 +24,8 @@ environment: ...@@ -24,6 +24,8 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_localizations:
sdk: flutter
test_package: test_package:
path: ../test_package path: ../test_package
......
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