Commit fd99e456 authored by laishanqi's avatar laishanqi

完善首页demo

parent 43eec03d
......@@ -33,5 +33,11 @@ class Images{
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";
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> {
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(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"主任医师",
textAlign: TextAlign.center,
"浏览主页",
style: TextStyle(
height: 1.1,
color: Colors.white,
fontSize: 11,
fontSize: 11
),
),
Image.asset(Images.ic_more_white_little)
......@@ -228,7 +218,6 @@ class _DoctorHomePageState extends State<DoctorHomePage> {
),
key: Key("${list[index]}"),
onDismissed: (direction) {
setState(() {
print(
"删除成功? ${list.remove(list[index])}, ${list.toString()}");
......
import 'package:flutter/material.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 {
}
onRegisterClick() {
Navigator.pushNamed(context, "doctorHome");
Navigator.pushNamed(context, "doctor_MainPage");
if(_formKey.currentState.validate()){
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("请求注册")));
}
......
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:netrain_flutter_app/xuehao/BottomNavpage.dart';
import 'package:netrain_flutter_app/xuehao/car_details.dart';
......@@ -10,7 +11,8 @@ 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/DoctorMain.dart';
import 'laishanqi/netrain/maintab/DoctorHomePage.dart';
import 'laishanqi/netrain/user/loginPage.dart';
import 'laishanqi/netrain/user/RegisterPage.dart';
import 'laishanqi/photo.dart';
......@@ -23,8 +25,6 @@ import 'zhangfeng/LayoutDemo.dart';
import 'jishuaishuai/firstVC.dart';
void main() {
runApp(MyApp());
// runApp(Login());
......@@ -33,13 +33,14 @@ void main() {
print("启动");
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
// 设置状态栏为透明
SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(statusBarColor:Colors.transparent);
SystemUiOverlayStyle systemUiOverlayStyle =
SystemUiOverlayStyle(statusBarColor: Colors.transparent);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
return WillPopScope(
......@@ -54,6 +55,15 @@ class MyApp extends StatelessWidget {
scaffoldBackgroundColor: Color(AppColors.scaffoldBackgroundColor),
visualDensity: VisualDensity.adaptivePlatformDensity,
),
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
const Locale('zh', 'CN'),
const Locale('en', 'US'),
],
routes: <String, WidgetBuilder>{
"less": (context) => LessGroupPage(),
"ful": (context) => FulGroupPage(),
......@@ -61,29 +71,29 @@ class MyApp extends StatelessWidget {
"photo": (context) => PhotoApp(),
"register": (context) => RegisterPage(),
"login": (context) => LoginPage(),
"listPage":(context) => List_Page(),
"CustomTabPage":(context) => TabBarPage(),
"LoginRequestPage":(context) => LoginRequestPage(),
"PageView":(context) => SampleAppPage(),
"LayoutDemo":(context) => LayoutDemo(),
"listPage": (context) => List_Page(),
"CustomTabPage": (context) => TabBarPage(),
"LoginRequestPage": (context) => LoginRequestPage(),
"PageView": (context) => SampleAppPage(),
"LayoutDemo": (context) => LayoutDemo(),
"main": (context) => mainPage(),
"firstVC":(context) => jssPageDemo(),
"car_details":(context) =>CarDetailsPage(),
"student":(context) => jssPageDemo(),
"grid_page":(context) =>GridPage(),
"doctorHome":(context) => DoctorHomePage(),
"bottom_page":(context) =>BottomNavPage(),
"firstVC": (context) => jssPageDemo(),
"car_details": (context) => CarDetailsPage(),
"student": (context) => jssPageDemo(),
"grid_page": (context) => GridPage(),
"doctorHome": (context) => DoctorHomePage(),
"bottom_page": (context) => BottomNavPage(),
"doctor_MainPage": (context) => doctorMainPage(),
},
),
onWillPop: () async {
Fluttertoast.showToast(msg: "退出");
return true;
});
}
}
Widget mainPage(){
Widget mainPage() {
return Scaffold(
appBar: AppBar(
title: Text("路由"),
......@@ -106,7 +116,10 @@ class _RouterNavigatorState extends State<RouterNavigator> {
@override
Widget build(BuildContext context) {
return Container(
child: Column(
child: Container(
margin: EdgeInsets.only(left: 10,right: 10),
child: Wrap(
spacing: 10,
children: [
SwitchListTile(
title: Text('${byName ? '' : '不'}通过路由名跳转'),
......@@ -116,22 +129,24 @@ class _RouterNavigatorState extends State<RouterNavigator> {
byName = value;
});
}),
_item("首页", LessGroupPage(), 'doctor_MainPage'),
_item("less页面", LessGroupPage(), 'less'),
_item("ful页面", FulGroupPage(), 'ful'),
_item("layout页面", LayoutPage(), 'layout'),
_item("拍照页面", PhotoApp(), 'photo'),
_item("登陆", LoginPage(), 'login'),
_item("登录网络请求", LoginRequestPage(), 'LoginRequestPage'),
_item("CustomTabPage",TabBarPage(),'CustomTabPage'),
_item("PageView",SampleAppPage(),'PageView'),
_item("CustomTabPage", TabBarPage(), 'CustomTabPage'),
_item("PageView", SampleAppPage(), 'PageView'),
_item("LayoutDemo", LayoutDemo(), 'LayoutDemo'),
_item("listview页面",List_Page(),'listPage'),
_item("listview页面", List_Page(), 'listPage'),
_item("jssDemo", jssPageDemo(), 'firstVC'),
_item("jssDemo", jssPageDemo(), 'student'),
_item("gridView",GridPage(),'grid_page'),
_item("BottomNav",BottomNavPage(),'bottom_page'),
_item("gridView", GridPage(), 'grid_page'),
_item("BottomNav", BottomNavPage(), 'bottom_page'),
],
),
),
);
}
......@@ -142,7 +157,11 @@ class _RouterNavigatorState extends State<RouterNavigator> {
if (byName) {
Navigator.pushNamed(context, routeName);
} else {
Navigator.push(context,MaterialPageRoute(builder: (context) => page,));
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => page,
));
}
},
child: Text(title),
......@@ -150,4 +169,3 @@ class _RouterNavigatorState extends State<RouterNavigator> {
);
}
}
......@@ -24,6 +24,8 @@ environment:
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
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