Commit 91caf80a authored by 杜欣's avatar 杜欣

二级方案

parent 606b3123
...@@ -3,10 +3,22 @@ ...@@ -3,10 +3,22 @@
* @date 2020-06-29 * @date 2020-06-29
**/ **/
import 'dart:math';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_common/commonModel/picker/base/BaseBottomPicker.dart';
import 'package:gm_flutter/ClueModel/page/levelOne/LevelOneItem.dart';
import 'package:gm_flutter/ClueModel/page/levelTwo/LevelTwoModel.dart'; import 'package:gm_flutter/ClueModel/page/levelTwo/LevelTwoModel.dart';
import 'package:gm_flutter/ClueModel/page/mechanismBox/MechanismBoxPage.dart';
import 'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart';
import 'package:gm_flutter/ClueModel/view/FiveStarView.dart';
import 'package:gm_flutter/commonModel/base/BaseState.dart'; import 'package:gm_flutter/commonModel/base/BaseState.dart';
import 'package:gm_flutter/commonModel/base/BaseUtil.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart'; import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:gm_flutter/commonModel/bean/Pair.dart';
class LevelTwoPage extends StatefulWidget { class LevelTwoPage extends StatefulWidget {
@override @override
...@@ -16,6 +28,8 @@ class LevelTwoPage extends StatefulWidget { ...@@ -16,6 +28,8 @@ class LevelTwoPage extends StatefulWidget {
class _LevelTwoPageState extends BaseState<LevelTwoPage> class _LevelTwoPageState extends BaseState<LevelTwoPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
LevelTwoModel _model = new LevelTwoModel(); LevelTwoModel _model = new LevelTwoModel();
RefreshController _refreshController = RefreshController();
PageController pageController = new PageController();
TabController tabController; TabController tabController;
@override @override
...@@ -27,6 +41,8 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage> ...@@ -27,6 +41,8 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
@override @override
void dispose() { void dispose() {
_model.dispose(); _model.dispose();
pageController.dispose();
_refreshController.dispose();
super.dispose(); super.dispose();
} }
...@@ -35,8 +51,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage> ...@@ -35,8 +51,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
return Scaffold( return Scaffold(
body: Stack( body: Stack(
children: <Widget>[ children: <Widget>[
CustomScrollView( CustomScrollView(slivers: <Widget>[
slivers: <Widget>[
SliverAppBar( SliverAppBar(
pinned: true, pinned: true,
elevation: 0, elevation: 0,
...@@ -56,7 +71,6 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage> ...@@ -56,7 +71,6 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
labelColor: Color(0xff282828), labelColor: Color(0xff282828),
labelStyle: labelStyle:
TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold), TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold),
labelPadding: EdgeInsets.only(top: 15.0),
unselectedLabelColor: Color(0xffB5B5B5), unselectedLabelColor: Color(0xffB5B5B5),
unselectedLabelStyle: TextStyle(fontSize: 15.0), unselectedLabelStyle: TextStyle(fontSize: 15.0),
indicatorColor: Color(0xff4ABAB4), indicatorColor: Color(0xff4ABAB4),
...@@ -64,24 +78,14 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage> ...@@ -64,24 +78,14 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.label,
indicatorPadding: EdgeInsets.only(left: 5.0, right: 5.0), indicatorPadding: EdgeInsets.only(left: 5.0, right: 5.0),
controller: this.tabController, controller: this.tabController,
tabs: <Widget>[ tabs: <Widget>[Tab(text: '医院'), Tab(text: '医生')]),
Tab(text: '医院'),
Tab(text: '医生'),
],
),
), ),
), ),
SliverFillRemaining( SliverFillRemaining(
child: TabBarView( child: TabBarView(
controller: this.tabController, controller: this.tabController,
children: <Widget>[ children: <Widget>[Container(), Container()]))
Center(child: Text('医院列表')), ]),
Center(child: Text('医生列表')),
],
),
),
],
),
Positioned(left: 0, right: 0, bottom: 0, child: bottomWidget()) Positioned(left: 0, right: 0, bottom: 0, child: bottomWidget())
], ],
)); ));
...@@ -147,9 +151,11 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage> ...@@ -147,9 +151,11 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
} }
Widget rect() { Widget rect() {
return StreamBuilder<List<String>>( return Padding(
padding: EdgeInsets.only(top: 20),
child: StreamBuilder<List<String>>(
stream: _model.rectLive.stream, stream: _model.rectLive.stream,
initialData: ["w", "w", "q", "w"], initialData: ["w", "w", "q", "w", "w", "w", "q", "w"],
builder: (c, data) { builder: (c, data) {
List<Widget> list = List(); List<Widget> list = List();
for (int i = 0; i < data.data.length; i += 2) { for (int i = 0; i < data.data.length; i += 2) {
...@@ -188,6 +194,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage> ...@@ -188,6 +194,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
), ),
); );
}, },
),
); );
} }
...@@ -268,7 +275,11 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage> ...@@ -268,7 +275,11 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
), ),
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () {}, onTap: () {
BaseBottomPicker()
..setPicker(MechanismBox())
..show(context);
},
child: Container( child: Container(
margin: EdgeInsets.only(left: 15), margin: EdgeInsets.only(left: 15),
width: 135, width: 135,
...@@ -299,6 +310,184 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage> ...@@ -299,6 +310,184 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
), ),
); );
} }
Widget pages() {
return Container(
margin: EdgeInsets.only(top: 5),
width: double.maxFinite,
child: ListView.builder(
physics: NeverScrollableScrollPhysics(),
itemBuilder: (c, index) {
return DoctorItem(c, []);
},
itemCount: 5,
));
}
}
Widget DoctorItem(BuildContext context, cards) {
if (cards.doctor == null && isDebug) {
throw new Exception();
}
return GestureDetector(
child: Container(
margin: EdgeInsets.only(left: 15, right: 15),
height: 127,
child: Stack(
children: <Widget>[
Positioned(
top: 15,
child: Container(
width: 45,
height: 45,
child: ClipOval(
child: CachedNetworkImage(
imageUrl: cards.doctor.portrait,
),
),
),
),
Positioned(
left: 57,
top: 18,
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
baseText(cards.doctor.name, 15, Color(0xff333333), bold: true),
Container(
margin: EdgeInsets.only(left: 4),
child: baseText(cards.doctor.name, 15, Color(0xff333333),
bold: true),
)
],
),
),
Positioned(
top: 42,
right: 0,
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
baseText("¥", 12, Color(0xffFF5963)),
baseText("${cards.doctor.minPrice}-${cards.doctor.maxPrice}",
15, Color(0xffFF5963)),
],
),
),
Positioned(
bottom: 15,
right: 0,
child: lowPriceWidget(),
),
Positioned(
bottom: 15,
right: 187,
child: askWidget(),
),
],
),
),
);
}
Widget HospitalItem(BuildContext context, cards) {
if (cards.hospital == null && isDebug) {
throw new Exception();
}
return GestureDetector(
onTap: () {},
child: Container(
margin: EdgeInsets.only(left: 15, right: 15),
height: 149,
child: Stack(
children: <Widget>[
Positioned(
left: 0,
top: 15,
child: Container(
width: 45,
height: 45,
child: ClipOval(
child: CachedNetworkImage(
imageUrl: cards.hospital.portrait,
),
),
),
),
Positioned(
left: 57,
top: 17.5,
child: baseText(cards.hospital.name, 15, Color(0xff333333),
bold: true),
),
Positioned(
top: 42.5,
right: 0,
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
baseText("¥", 12, Color(0xffFF5963)),
baseText(
"${cards.hospital.minPrice}-${cards.hospital.maxPrice}",
15,
Color(0xffFF5963)),
],
),
),
Positioned(
bottom: 15,
right: 0,
child: lowPriceWidget(),
),
Positioned(
bottom: 15,
right: 187,
child: askWidget(),
),
Positioned(
bottom: 67,
left: 57,
child: baseText(cards.hospital.address, 12, Color(0xff666666)),
),
Positioned(
left: 57,
top: 43.5,
child: FiveStarView(cards.hospital.star, 5),
)
],
),
));
}
Widget lowPriceWidget() {
return GestureDetector(
behavior: HitTestBehavior.opaque,
child: Container(
width: 122,
height: 37,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18.5), color: Color(0xffFFF5F5)),
alignment: Alignment.center,
child: baseText("获取底价", 14, Color(0xffFF5963), bold: true),
),
);
}
Widget askWidget() {
return GestureDetector(
behavior: HitTestBehavior.opaque,
child: Container(
width: 122,
height: 37,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18.5), color: Color(0xffEEFDFD)),
alignment: Alignment.center,
child: baseText("咨询", 14, Color(0xff3FB5AF), bold: true),
),
);
} }
class StickyTabBarDelegate extends SliverPersistentHeaderDelegate { class StickyTabBarDelegate extends SliverPersistentHeaderDelegate {
......
import 'package:flutter/material.dart';
import 'package:flutter_common/commonModel/picker/base/BaseBottomPicker.dart';
import '../../../commonModel/GMBase.dart';
import '../../../commonModel/base/BaseComponent.dart';
import '../../../commonModel/base/BaseComponent.dart';
class MechanismBox implements IBottomPicker {
VoidCallback dismissCall;
@override
initState(dismissCall, BuildContext context) {
this.dismissCall = dismissCall;
}
Widget build(BuildContext context) {
MediaQueryData mq = MediaQuery.of(context);
TextEditingController textController = TextEditingController();
return ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0)),
child: Container(
width: mq.size.width,
height: mq.size.height - 140,
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 20, right: 20),
width: mq.size.width,
decoration: BoxDecoration(
border: Border(
bottom:
BorderSide(width: 1, color: Color(0xffE5E5E5)))),
height: 50,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Container(
child: Text(
'请选择要咨询的机构',
style: TextStyle(
color: Color(0xff282828),
fontSize: 17,
fontWeight: FontWeight.bold),
),
),
Positioned(
right: 0,
top: 16.0,
child: GestureDetector(
onTap: () {
dismissCall();
},
child: Container(
width: 14,
height: 14,
child: Image.asset("assets/close-btn.png"),
),
))
],
),
),
Container(
height: mq.size.height - 140 - 50 - 96,
width: mq.size.width,
padding: EdgeInsets.only(left: 20, right: 20),
child: ListView.separated(
itemCount: 100,
itemBuilder: (BuildContext context, int index) {
return ListTile(title: Text("$index"));
},
separatorBuilder: (BuildContext context, int index) {
return Divider(color: Color(0xffE5E5E5));
},
)),
Container(
height: 96,
color: Color(0xffF9F8FB),
child: Column(
children: <Widget>[
Container(
height: 25,
width: double.maxFinite,
margin: EdgeInsets.only(top: 12),
child: ListView(
scrollDirection: Axis.horizontal, //横向滚动
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 15, right: 8),
height: 25,
child: Text(
'我想',
style: TextStyle(
height: 2,
color: Color(0xff666666),
fontSize: 12),
)),
Container(
height: 25,
margin: EdgeInsets.only(right: 12),
padding: EdgeInsets.only(left: 8, right: 8),
decoration: BoxDecoration(
border: Border.all(
color: Color(0xffE5E5E5), width: 0.5),
color: Color(0xffffffff),
borderRadius: BorderRadius.circular(20)),
child: Text(
'有优惠活动吗?',
style: TextStyle(
fontSize: 12,
color: Color(0xff666666),
height: 1.8),
),
),
Container(
height: 25,
margin: EdgeInsets.only(right: 12),
padding: EdgeInsets.only(left: 8, right: 8),
decoration: BoxDecoration(
border: Border.all(
color: Color(0xffE5E5E5), width: 0.5),
color: Color(0xffffffff),
borderRadius: BorderRadius.circular(20)),
child: Text(
'111有优惠活动吗?',
style: TextStyle(
fontSize: 12,
color: Color(0xff666666),
height: 1.8),
)),
Container(
height: 25,
margin: EdgeInsets.only(right: 12),
padding: EdgeInsets.only(left: 8, right: 8),
decoration: BoxDecoration(
border: Border.all(
color: Color(0xffE5E5E5), width: 0.5),
color: Color(0xffffffff),
borderRadius: BorderRadius.circular(20)),
child: Text(
'111有优惠活动吗?',
style: TextStyle(
fontSize: 12,
color: Color(0xff666666),
height: 1.8),
)),
Container(
height: 25,
margin: EdgeInsets.only(right: 12),
padding: EdgeInsets.only(left: 8, right: 8),
decoration: BoxDecoration(
border: Border.all(
color: Color(0xffE5E5E5), width: 0.5),
color: Color(0xffffffff),
borderRadius: BorderRadius.circular(20)),
child: Text(
'111有优惠活动吗?',
style: TextStyle(
fontSize: 12,
color: Color(0xff666666),
height: 1.8),
))
],
),
),
Container(
height: 35,
margin: EdgeInsets.only(top: 12, left: 15, right: 15),
decoration: BoxDecoration(
border: Border.all(
color: Color(0xffE5E5E5), width: 0.5),
color: Color(0xffffffff),
borderRadius: BorderRadius.circular(35)),
child: TextField(
controller: textController,
keyboardType: TextInputType.text,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(16.0),
labelText: '文案文案文案不知道文案是啥',
border: InputBorder.none),
autofocus: false,
),
)
],
))
],
)),
);
}
@override
void dispose() {
dismissCall();
}
}
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