Commit 1cb532f5 authored by 杜欣's avatar 杜欣

Merge branch 'test' into featrue/duxin

parents f3daabf2 677bfbe3
......@@ -18,6 +18,9 @@ abstract class ClueRouter implements RouterBaser {
Widget getLevelTwoPage();
Widget getPlanPage();
Widget getPlanPage();
Widget getPlanCompareDetailPage();
Widget getTopPage();
}
......@@ -10,6 +10,7 @@ import 'package:gm_flutter/ClueModel/page/levelOne/LevelOnePage.dart';
import 'package:gm_flutter/ClueModel/page/levelTwo/LevelTwoPage.dart';
import 'package:gm_flutter/ClueModel/page/plan/PlanPage.dart';
import 'package:gm_flutter/ClueModel/page/PlanCompareDetail/PlanCompareDetailPage.dart';
import 'package:gm_flutter/ClueModel/page/top/TopPage.dart';
class ClueRouterImpl implements ClueRouter {
@override
......@@ -40,4 +41,9 @@ class ClueRouterImpl implements ClueRouter {
Widget getPlanCompareDetailPage() {
return PlanCompareDetailPage();
}
@override
Widget getTopPage() {
return TopPage();
}
}
......@@ -2,7 +2,7 @@
* @Author: zx
* @Date: 2020-06-30 17:43:13
* @Last Modified by: zx
* @Last Modified time: 2020-07-01 20:04:23
* @Last Modified time: 2020-07-02 13:50:15
*/
import 'package:flutter_common/commonModel/live/BaseModel.dart';
import 'package:flutter_common/commonModel/live/LiveData.dart';
......@@ -10,25 +10,49 @@ import 'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanCompareDetail.dart';
import 'package:gm_flutter/commonModel/GMBase.dart';
import 'package:gm_flutter/commonModel/rx/RxDispose.dart';
import 'package:flutter_common/commonModel/toast/NativeToast.dart';
import 'package:gm_flutter/commonModel/util/PrintUtil.dart';
import 'package:gm_flutter/commonModel/bean/Pair.dart';
class PlanCompareDetailModel extends BaseModel {
LiveData<PlanCompareDetail> detailLive = LiveData();
LiveData<Pair<int, List<Groups>>> detailLive = LiveData();
LiveData<Pair<int, List<PlansInfo>>> headerLive = LiveData();
LiveData<int> stateLive = LiveData();
RxDispose rxDispose = RxDispose();
void init() {
void init(List<int> planIds) {
ClueApiImpl.getInstance()
.getPlanCompareDetail(DioUtil.getInstance().getDio(), [1,2])
.getPlanCompareDetail(DioUtil.getInstance().getDio(), planIds)
.listen((event) {
if (event.error == 0) {
detailLive.notifyView(event);
stateLive.notifyView(ENDLOADING);
if (event.data.plansInfo == null || event.data.groups.isEmpty) {
headerLive.notifyView(Pair(ENDLOADING, []));
detailLive.notifyView(Pair(ENDLOADING, []));
} else {
detailLive.notifyView(Pair(ENDLOADING, event.data.groups));
headerLive.notifyView(Pair(ENDLOADING, event.data.plansInfo));
}
} else {
stateLive.notifyView(FAIL);
NativeToast.showNativeToast(event.message);
headerLive.notifyView(Pair(FAIL, null));
detailLive.notifyView(Pair(FAIL, null));
}
})
.addToDispose(rxDispose)
.onError((err) {});
.onError((err) {
stateLive.notifyView(FAIL);
headerLive.notifyView(Pair(FAIL, null));
detailLive.notifyView(Pair(FAIL, null));
NativeToast.showNativeToast(err.message);
});
}
@override
void dispose() {
stateLive.dispost();
detailLive.dispost();
}
}
\ No newline at end of file
}
......@@ -22,8 +22,11 @@ class PlansCompareFeedItemView extends StatelessWidget {
}
getFirstLevelItem() {
Container(
margin: EdgeInsets.all(4.0),
return Container(
width: double.maxFinite,
height: 90,
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 15, right: 15, top: 20, bottom: 20),
child: Row(
children: <Widget>[
Radio(
......@@ -32,51 +35,56 @@ class PlansCompareFeedItemView extends StatelessWidget {
onChanged: (value) {
groupValue = value;
}),
ClipRRect(
borderRadius: BorderRadius.circular(2.0),
child: Image.network(
plan.projectImage,
width: 50,
height: 50,
fit: BoxFit.fill,
Container(
margin: EdgeInsets.only(left: 15, right: 15),
child: ClipRRect(
borderRadius: BorderRadius.circular(2.0),
child: Image.network(
plan.projectImage,
width: 50,
height: 50,
fit: BoxFit.fill,
),
),
),
Expanded(
child: Container(
margin: EdgeInsets.only(left: 8.0),
Container(
height: 50,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
plan.name,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Color(0xFF282828)),
maxLines: 1,
),
Text(
"好评率 ",
style: TextStyle(fontSize: 11, color: Color(0xFF282828)),
maxLines: 1,
),
Text(
plan.positiveRate,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Color(0xFFFF5963)),
maxLines: 1,
),
],
Container(
margin: EdgeInsets.only(top: 2, bottom: 5),
child: Row(
children: <Widget>[
Text(
plan.name,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Color(0xFF282828)),
maxLines: 1,
),
Text(
"好评率 ",
style:
TextStyle(fontSize: 11, color: Color(0xFF282828)),
maxLines: 1,
),
Text(
plan.positiveRate,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Color(0xFFFF5963)),
maxLines: 1,
),
],
),
),
Row(
children: <Widget>[
Text(
'¥${plan.minPrice}-${plan.maxPrice})',
'¥${plan.minPrice}-${plan.maxPrice}',
style: TextStyle(fontSize: 13, color: Color(0xFFFF5963)),
),
Text(
......@@ -88,15 +96,18 @@ class PlansCompareFeedItemView extends StatelessWidget {
)
],
),
))
)
],
),
);
}
getSecondLevelItem() {
Container(
margin: EdgeInsets.all(4.0),
return Container(
width: double.maxFinite,
height: 77,
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(left: 15, right: 15),
child: Row(
children: <Widget>[
Radio(
......@@ -105,37 +116,44 @@ class PlansCompareFeedItemView extends StatelessWidget {
onChanged: (value) {
groupValue = value;
}),
Expanded(
child: Container(
margin: EdgeInsets.only(left: 8.0),
height: 50,
Container(
margin: EdgeInsets.only(left: 15.0),
height: 77,
alignment: Alignment.centerLeft,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
plan.name,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Color(0xFF282828)),
maxLines: 1,
Container(
margin: EdgeInsets.only(top: 13.0, bottom: 12),
child: Text(
plan.name,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Color(0xFF282828)),
maxLines: 1,
),
),
Row(
children: <Widget>[
Text(
'¥${plan.minPrice}-${plan.maxPrice})',
'¥${plan.minPrice}-${plan.maxPrice}',
style: TextStyle(fontSize: 13, color: Color(0xFFFF5963)),
),
Text(
"指导价:¥${plan.guidePrice}",
style: TextStyle(fontSize: 11, color: Color(0xFF282828)),
maxLines: 1,
)
Container(
alignment: Alignment.centerRight,
child: Text(
"指导价:¥${plan.guidePrice}",
style:
TextStyle(fontSize: 11, color: Color(0xFF282828)),
maxLines: 1,
),
),
],
)
],
),
))
)
],
),
);
......
......@@ -4,6 +4,7 @@ import 'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlansCompareFeed.dart';
import 'package:gm_flutter/commonModel/net/DioUtil.dart';
import 'package:gm_flutter/commonModel/rx/RxDispose.dart';
import 'package:gm_flutter/commonModel/util/PrintUtil.dart';
class PlansCompareFeedModel extends BaseModel {
LiveData<PlansCompareFeed> liveData = LiveData();
......@@ -13,12 +14,12 @@ class PlansCompareFeedModel extends BaseModel {
ClueApiImpl.getInstance()
.getPlansCompareFeed(DioUtil.getInstance().getDio(), 123, 1)
.listen((event) {
if (event.error == 0) {
liveData.notifyView(event);
}
liveData.notifyView(event);
})
.addToDispose(rxDispose)
.onError((err) {});
.onError((err) {
PrintUtil.printBug(err);
});
}
@override
......
......@@ -38,9 +38,12 @@ class PlansCompareFeedState extends BaseState<PlansCompareFeedPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("方案对比"),
),
appBar: baseAppBar(
title: "方案对比",
centerTitle: true,
backClick: () {
Navigator.pop(context);
}),
body: Center(
child: getBody(),
),
......@@ -75,11 +78,19 @@ class PlansCompareFeedState extends BaseState<PlansCompareFeedPage> {
getBody() {
return StreamBuilder(
stream: _model.liveData.stream,
initialData: PlansCompareFeed(),
initialData: _model.liveData.data ?? null,
builder: (c, data) {
if (_model.liveData.data == null) {
return loadingItem();
}
PlansCompareFeed item = data.data;
if (item == null || item.data == null || item.data.plans == null) {
return loadingItem();
return emptyItem(MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height);
}
if (item.error != 0) {
return errorItem(MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height, () {});
}
return getList(item.data.plans);
},
......
......@@ -18,13 +18,22 @@ class ProjectDetailsItemView extends StatelessWidget {
for (var item in listData.attrs) {
tiles.add(getItem(item));
}
var row = Row(
var column = Column(
children: <Widget>[
Container(
padding: EdgeInsets.only(top: 8.0, bottom: 8.0, left: 20),
padding: EdgeInsets.only(left: 15.0),
margin: EdgeInsets.only(bottom: 16.0),
alignment: Alignment.centerLeft,
width: double.maxFinite,
height: 55,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/bg_project_detail_item.png"),
fit: BoxFit.cover)),
child: Text(
listData.name,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Color(0xFF000000),
fontSize: 15.0,
),
......@@ -36,30 +45,38 @@ class ProjectDetailsItemView extends StatelessWidget {
],
);
return Container(
margin: EdgeInsets.only(bottom: 5, left: 20),
child: row,
margin: EdgeInsets.only(bottom: 5),
child: column,
);
}
getItem(Attrs attrs) {
var row = Container(
margin: EdgeInsets.only(bottom: 25),
width: double.maxFinite,
margin: EdgeInsets.only(bottom: 25, left: 15, right: 15),
child: Row(
children: <Widget>[
Text(
attrs.attrName,
style: TextStyle(
color: Color(0xFF999999),
fontSize: 13.0,
Container(
margin: EdgeInsets.only(right: 25.0),
alignment: Alignment.centerLeft,
width: 78,
child: Text(
attrs.attrName,
style: TextStyle(
color: Color(0xFF999999),
fontSize: 13.0,
),
),
),
Text(
attrs.attrValue,
style: TextStyle(
color: Color(0xFF282828),
fontSize: 14.0,
Container(
alignment: Alignment.centerLeft,
child: Text(
attrs.attrValue,
style: TextStyle(
color: Color(0xFF282828),
fontSize: 14.0,
),
),
maxLines: 1,
),
],
),
......
......@@ -20,15 +20,12 @@ class ProjectDetailsModel extends BaseModel {
ClueApiImpl.getInstance()
.getProjectDetails(DioUtil.getInstance().getDio(), 123)
.listen((event) {
print(event);
if (event.error == 0) {
liveData.notifyView(event);
}
liveData.notifyView(event);
})
.addToDispose(rxDispose)
.onError((err) {
PrintUtil.printBug(err);
});
PrintUtil.printBug(err);
});
}
@override
......
......@@ -38,11 +38,12 @@ class ProjectDetailsState extends BaseState<ProjectDetailsPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: baseAppBar(title: "项目说明",
centerTitle: true,
backClick: (){
Navigator.pop(context);
}),
appBar: baseAppBar(
title: "项目说明",
centerTitle: true,
backClick: () {
Navigator.pop(context);
}),
body: Center(
child: getBody(),
),
......@@ -52,11 +53,19 @@ class ProjectDetailsState extends BaseState<ProjectDetailsPage> {
getBody() {
return StreamBuilder(
stream: _model.liveData.stream,
initialData: ProjectDetailsItem(),
initialData: _model.liveData.data ?? null,
builder: (c, data) {
if (_model.liveData.data == null) {
return loadingItem();
}
ProjectDetailsItem item = data.data;
if (item == null || item.data == null || item.data.groups == null) {
return loadingItem();
return emptyItem(MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height);
}
if (item.error != 0) {
return errorItem(MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height, () {});
}
return ListView.builder(
itemCount: item.data.groups.length,
......
......@@ -84,18 +84,9 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
SliverPersistentHeader(
pinned: true,
delegate: StickyTabBarDelegate(
child: TabBar(
labelColor: Color(0xff282828),
labelStyle:
TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold),
unselectedLabelColor: Color(0xffB5B5B5),
unselectedLabelStyle: TextStyle(fontSize: 15.0),
indicatorColor: Color(0xff4ABAB4),
indicatorWeight: 3.0,
indicatorSize: TabBarIndicatorSize.label,
indicatorPadding: EdgeInsets.only(left: 5.0, right: 5.0),
controller: this.tabController,
tabs: <Widget>[Tab(text: '医院'), Tab(text: '医生')]),
child: baseTabBar(tabController,
[baseTabBarItem("医院"), baseTabBarItem("医生")], (index) {},
scroll: false),
),
),
SliverFillRemaining(child: pages())
......@@ -517,7 +508,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
}
class StickyTabBarDelegate extends SliverPersistentHeaderDelegate {
final TabBar child;
final Widget child;
StickyTabBarDelegate({@required this.child});
......@@ -528,10 +519,10 @@ class StickyTabBarDelegate extends SliverPersistentHeaderDelegate {
}
@override
double get maxExtent => this.child.preferredSize.height;
double get maxExtent => 40;
@override
double get minExtent => this.child.preferredSize.height;
double get minExtent => 40;
@override
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) {
......
......@@ -20,6 +20,7 @@ class PlanModel extends BaseModel {
LiveData<List<double>> posLive = new LiveData();
LiveData<List<double>> backLive = new LiveData();
LiveData<List<Ranks>> picLive = LiveData();
LiveData<bool> showTab = LiveData();
LiveData<int> stateLive = LiveData();
double menuBottom;
......@@ -108,6 +109,7 @@ class PlanModel extends BaseModel {
posLive.dispost();
backLive.dispost();
feedsLive.dispost();
showTab.dispost();
}
void backProgress(double pro, int index) {
......
......@@ -9,6 +9,7 @@ import 'dart:ui';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gm_flutter/ClueModel/page/levelTwo/LevelTwoPage.dart';
import 'package:gm_flutter/ClueModel/page/plan/FilterView.dart';
import 'package:gm_flutter/ClueModel/page/plan/PlanBar.dart';
import 'package:gm_flutter/ClueModel/page/plan/PlanItem.dart';
......@@ -33,7 +34,7 @@ class PlanPage extends StatefulWidget {
State<StatefulWidget> createState() => PlanState();
}
class PlanState extends BaseState<PlanPage> {
class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
PlanModel _model = PlanModel();
TextEditingController _editingController = TextEditingController();
FocusNode focusNode = FocusNode();
......@@ -53,8 +54,8 @@ class PlanState extends BaseState<PlanPage> {
_model.init();
planBarView =
PlanBarView(_model.managerLive, clickIndex, hideAllMenuListener);
planList.add(towPic());
planList.add(planBar());
planList.add(towPic().toActive());
planList.add(planBar().toActive());
planList.add(pages());
}
......@@ -110,7 +111,9 @@ class PlanState extends BaseState<PlanPage> {
child: Column(
children: <Widget>[
Container(
height: data.data[1] - 45,
height: data.data[1] - 45 < 0
? 0
: data.data[1] - 45,
color: Colors.transparent,
),
Container(
......@@ -215,6 +218,19 @@ class PlanState extends BaseState<PlanPage> {
},
);
}),
StreamBuilder<bool>(
stream: _model.showTab.stream,
initialData: _model.showTab.data ?? false,
builder: (c, data) {
return Visibility(
visible: data.data,
child: Container(
color: Colors.white,
child: planBarView,
),
);
},
)
],
),
)
......@@ -303,9 +319,7 @@ class PlanState extends BaseState<PlanPage> {
focusNode: focusNode,
autocorrect: false,
autofocus: false,
textInputAction: Platform.isAndroid
? TextInputAction.newline
: TextInputAction.send,
textInputAction: TextInputAction.search,
controller: _editingController,
minLines: null,
onEditingComplete: () {},
......@@ -316,27 +330,35 @@ class PlanState extends BaseState<PlanPage> {
}
Widget child() {
return baseRefreshView(
refreshController,
() {
_model.refreshFeed(true);
return NotificationListener(
onNotification: (scrollNotification) {
if (scrollNotification is ScrollUpdateNotification &&
scrollNotification.metrics.axisDirection.index == 2) {
_onScroll(scrollNotification.metrics.pixels);
}
return false;
},
Container(
width: 0,
height: 0,
),
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return planList[index];
child: baseRefreshView(
refreshController,
() {
_model.refreshFeed(true);
},
childCount: planList.length,
),
),
onLoading: () {
_model.loadMore();
},
pullUp: true);
Container(
width: 0,
height: 0,
),
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return planList[index];
},
childCount: planList.length,
),
),
onLoading: () {
_model.loadMore();
},
pullUp: true));
}
Widget towPic() {
......@@ -410,8 +432,14 @@ class PlanState extends BaseState<PlanPage> {
}
void clickIndex(int index) {
var topPos = PosUtil.findPos(globalKey);
double bottom =
WidgetUtil.buttonLeftMenuPosition(globalKey.currentContext).top - 86;
// WidgetUtil.buttonLeftMenuPosition(globalKey.currentContext)?.top ??
topPos == null ? 0.0 : topPos.dy + 45 - 86;
if (bottom < 45) {
bottom = 45;
}
_model.menuBottom = bottom;
if (_model.menuIndex == index || _model.menuIndex == -1) {
_model.needChangBack = true;
......@@ -449,6 +477,7 @@ class PlanState extends BaseState<PlanPage> {
height = max(_model.feedDatas.length * 100.0, height);
}
return Container(
color: Color(0xffF7F6FA),
width: double.maxFinite,
height: height,
child: ListView.builder(
......@@ -479,4 +508,27 @@ class PlanState extends BaseState<PlanPage> {
},
);
}
void _onScroll(double offset) {
var topPos = PosUtil.findPos(globalKey);
if (topPos != null) {
if (topPos.dy > 86) {
_model.showTab.notifyView(false);
} else {
_model.showTab.notifyView(true);
}
}
// if (topPos != null && topPos.dy < 0) {
// double dy = -topPos.dy;
// if (dy < 20) {
// dy = 0;
// }
// double alpha = dy / 112;
// if (alpha < 0) {
// alpha = 0;
// } else if (alpha > 1) {
// alpha = 1;
// }
// _model.showTab.notifyView(alpha);
}
}
/*
* @author lsy
* @date 2020/7/2
**/
import 'package:flutter_common/commonModel/live/BaseModel.dart';
import 'package:flutter_common/commonModel/live/LiveData.dart';
class TopModel extends BaseModel {
int tabIndex = 0;
List<String> tabs = ["全部", "眼部", "自体脂肪", "轮廓骨骼"];
@override
void dispose() {}
void selectTab(int index) {
if (tabIndex == index) {
return;
}
tabIndex = index;
}
}
/*
* @author lsy
* @date 2020/7/2
**/
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gm_flutter/ClueModel/page/levelTwo/LevelTwoPage.dart';
import 'package:gm_flutter/ClueModel/page/top/TopModel.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
import 'package:gm_flutter/commonModel/base/BaseState.dart';
import 'package:gm_flutter/commonModel/view/baseTabIndicator.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
class TopPage extends StatefulWidget {
@override
State<StatefulWidget> createState() => TopPageState();
}
class TopPageState extends BaseState<TopPage> with TickerProviderStateMixin {
RefreshController refreshController = RefreshController();
TabController tabController;
TopModel _model = TopModel();
@override
void initState() {
tabController = TabController(length: 4, vsync: this);
super.initState();
}
@override
void dispose() {
refreshController.dispose();
super.dispose();
}
@override
Widget buildItem(BuildContext context) {
return Scaffold(
body: home(),
);
}
Widget home() {
return baseRefreshView(refreshController, () {}, null, null,
customScrollView: CustomScrollView(slivers: <Widget>[
SliverAppBar(
pinned: true,
elevation: 0,
expandedHeight: 0,
flexibleSpace: FlexibleSpaceBar(title: Text('二级方案')),
),
SliverToBoxAdapter(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Container(
height: 50,
color: Colors.pink,
)
],
)),
SliverPersistentHeader(
pinned: true,
delegate: StickyTabBarDelegate(
child: Container(
height: 40,
color: Colors.white,
child: baseTabBar(tabController, getTabs(), (index) {
_model.selectTab(index);
}),
)),
),
SliverFillRemaining(
child: TabBarView(controller: tabController, children: <Widget>[
Container(
color: Colors.red,
),
Container(
color: Colors.red,
),
Container(
color: Colors.red,
),
Container(
color: Colors.blue,
)
]))
]));
}
List<Widget> getTabs() {
List<Widget> list = [];
for (int i = 0; i < _model.tabs.length; i++) {
list.add(baseTabBarItem(_model.tabs[i],
leftPadding: i == 0 ? 24 : 28,
rightPadding: i == _model.tabs.length - 1 ? 24 : 28));
}
return list;
}
}
......@@ -19,11 +19,11 @@ import 'package:gm_flutter/commonModel/net/Responce/SimpleResponce.dart';
@ServiceCenter()
abstract class ClueApi {
@Get("/api/janus/plans/plan_detail")
ProjectDetailsItem getProjectDetails(@Query("plan_id") int plan_id);
ProjectDetailsItem getProjectDetails(@Query("plan_id") double plan_id);
@Get("/api/janus/plans/compare_feed")
PlansCompareFeed getPlansCompareFeed(
@Query("plan_id") int plan_id, @Query("plan_type") int plan_type);
@Query("plan_id") double plan_id, @Query("plan_type") double plan_type);
@Get("api/janus/plans/plan_feed")
LevelOneFeedList getLevelOneList(@Query("plan_id") int plan_id,
......
......@@ -40,7 +40,7 @@ class ClueApiImpl {
return _instance;
}
Stream<ProjectDetailsItem> getProjectDetails(Dio _dio, int plan_id) {
Stream<ProjectDetailsItem> getProjectDetails(Dio _dio, double plan_id) {
return Stream.fromFuture(get(_dio, '/api/janus/plans/plan_detail', data: {
'plan_id': plan_id,
})).flatMap((value) {
......@@ -55,7 +55,7 @@ class ClueApiImpl {
}
Stream<PlansCompareFeed> getPlansCompareFeed(
Dio _dio, int plan_id, int plan_type) {
Dio _dio, double plan_id, double plan_type) {
return Stream.fromFuture(get(_dio, '/api/janus/plans/compare_feed', data: {
'plan_id': plan_id,
'plan_type': plan_type,
......
......@@ -3,7 +3,7 @@ class PlansCompareFeed {
String message;
String extra;
String errorExtra;
String userType;
UserType userType;
Data data;
PlansCompareFeed(
......@@ -19,7 +19,9 @@ class PlansCompareFeed {
message = json['message'];
extra = json['extra'];
errorExtra = json['error_extra'];
userType = json['user_type'];
userType = json['user_type'] != null
? new UserType.fromJson(json['user_type'])
: null;
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
......@@ -29,7 +31,9 @@ class PlansCompareFeed {
data['message'] = this.message;
data['extra'] = this.extra;
data['error_extra'] = this.errorExtra;
data['user_type'] = this.userType;
if (this.userType != null) {
data['user_type'] = this.userType.toJson();
}
if (this.data != null) {
data['data'] = this.data.toJson();
}
......@@ -37,6 +41,17 @@ class PlansCompareFeed {
}
}
class UserType {
UserType();
UserType.fromJson(Map<String, dynamic> json) {}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
return data;
}
}
class Data {
List<Plans> plans;
......
......@@ -3,7 +3,7 @@ class ProjectDetailsItem {
String message;
String extra;
String errorExtra;
String userType;
UserType userType;
Data data;
ProjectDetailsItem(
......@@ -19,7 +19,9 @@ class ProjectDetailsItem {
message = json['message'];
extra = json['extra'];
errorExtra = json['error_extra'];
userType = json['user_type'];
userType = json['user_type'] != null
? new UserType.fromJson(json['user_type'])
: null;
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
......@@ -29,7 +31,9 @@ class ProjectDetailsItem {
data['message'] = this.message;
data['extra'] = this.extra;
data['error_extra'] = this.errorExtra;
data['user_type'] = this.userType;
if (this.userType != null) {
data['user_type'] = this.userType.toJson();
}
if (this.data != null) {
data['data'] = this.data.toJson();
}
......@@ -37,6 +41,17 @@ class ProjectDetailsItem {
}
}
class UserType {
UserType();
UserType.fromJson(Map<String, dynamic> json) {}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
return data;
}
}
class Data {
int id;
String name;
......
......@@ -7,8 +7,9 @@ import 'package:flutter/cupertino.dart';
class FiveStarView extends StatelessWidget {
final int allStarCount;
final int lightStarCount;
String starAssets;
FiveStarView(this.lightStarCount, this.allStarCount);
FiveStarView(this.lightStarCount, this.allStarCount, {this.starAssets});
@override
Widget build(BuildContext context) {
......@@ -18,7 +19,7 @@ class FiveStarView extends StatelessWidget {
list.add(Container(
height: 13,
width: 13,
child: Image.asset("assets/sel_star.png"),
child: Image.asset(starAssets ?? "assets/sel_star.png"),
));
if (i != 0 && i != allStarCount - 1) {
list.add(Container(
......
......@@ -45,6 +45,14 @@ class TestState extends BaseState<TestPage> {
JumpUtil.jumpToPageRight(
context, RouterCenterImpl().findClueRouter().getProjectDetailsPage());
}));
list.add(listItem("方案对比", () {
JumpUtil.jumpToPageRight(context, RouterCenterImpl().findClueRouter().getPlansCompareFeed());
}));
list.add(listItem("榜单", () {
JumpUtil.jumpToPageRight(context, RouterCenterImpl().findClueRouter().getTopPage());
}));
return list;
}
......
......@@ -13,6 +13,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:gm_flutter/commonModel/GMBase.dart';
import 'package:gm_flutter/commonModel/util/DartUtil.dart';
import 'package:gm_flutter/commonModel/view/ImagesAnimation.dart';
import 'package:gm_flutter/commonModel/view/baseTabIndicator.dart';
import 'package:lottie/lottie.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
......@@ -396,3 +397,36 @@ Widget emptyItem(double width, double height, {String detail}) {
),
);
}
Widget baseTabBar(
TabController controller, List<Widget> list, Function(int index) clickItem,
{BaseIndicator baseIndicator, double fontSize, Color color, bool scroll}) {
return TabBar(
onTap: clickItem,
controller: controller,
indicatorSize: TabBarIndicatorSize.tab,
isScrollable: scroll ?? true,
unselectedLabelColor: color ?? Color(0xffB5B5B5),
labelColor: color ?? Color(0xff282828),
labelStyle: TextStyle(fontSize: fontSize ?? 16),
unselectedLabelStyle: TextStyle(fontSize: fontSize ?? 16),
labelPadding: EdgeInsets.only(),
indicator: baseIndicator ?? BaseIndicator(),
tabs: list,
);
}
Widget baseTabBarItem(String text,
{double leftPadding, double rightPadding, double wantWidth}) {
leftPadding = leftPadding ?? 28.0;
rightPadding = rightPadding ?? 28.0;
double width = leftPadding + text.length * 16.0 + rightPadding;
return Container(
height: 40,
width: wantWidth ?? width,
alignment: Alignment.center,
child: Tab(
text: text,
),
);
}
......@@ -19,7 +19,13 @@ class WidgetUtil {
}
static RelativeRect buttonLeftMenuPosition(BuildContext c) {
if (c == null) {
return null;
}
final RenderBox bar = c.findRenderObject();
if (Overlay.of(c).context == null) {
return null;
}
final RenderBox overlay = Overlay.of(c).context.findRenderObject();
final RelativeRect position = RelativeRect.fromRect(
Rect.fromPoints(
......
library md2_tab_indicator;
import 'package:flutter/widgets.dart';
class BaseIndicator extends Decoration {
double indicatorHeight;
Color indicatorColor;
double indicatorRadius;
double indicatorWidth;
double indicatorPaddingBottom;
BaseIndicator(
{this.indicatorHeight,
this.indicatorColor,
this.indicatorRadius,
this.indicatorWidth,
this.indicatorPaddingBottom}) {
indicatorHeight = indicatorHeight ?? 3.0;
indicatorColor = indicatorColor ?? Color(0xff3FB5AF);
indicatorRadius = indicatorRadius ?? 1.5;
indicatorWidth = indicatorWidth ?? 22.0;
indicatorPaddingBottom = indicatorPaddingBottom ?? 6.0;
}
@override
_MD2Painter createBoxPainter([VoidCallback onChanged]) {
return new _MD2Painter(this, onChanged);
}
}
class _MD2Painter extends BoxPainter {
final BaseIndicator decoration;
_MD2Painter(this.decoration, VoidCallback onChanged)
: assert(decoration != null),
super(onChanged);
@override
void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) {
assert(configuration != null);
assert(configuration.size != null);
Rect rect = Offset(
offset.dx +
configuration.size.width / 2 -
decoration.indicatorWidth / 2,
(configuration.size.height -
decoration.indicatorHeight -
decoration.indicatorPaddingBottom)) &
Size(decoration.indicatorWidth, decoration.indicatorHeight);
final Paint paint = Paint();
paint.color = decoration.indicatorColor;
paint.style = PaintingStyle.fill;
double radius = decoration.indicatorRadius;
canvas.drawRRect(
RRect.fromRectAndCorners(rect,
topRight: Radius.circular(radius),
topLeft: Radius.circular(radius),
bottomLeft: Radius.circular(radius),
bottomRight: Radius.circular(radius)),
paint);
}
}
......@@ -78,7 +78,10 @@ class MyApp extends State<MyAppWidget> {
theme: ThemeData(
primaryColor: Colors.white,
cursorColor: Color(0xff20BDBB),
highlightColor:Colors.transparent,
splashColor:Colors.transparent,
canvasColor: Colors.white),
builder: FlutterBoost.init(postPush: _onRoutePushed),
home: isDebug
? RouterCenterImpl().findMainRouter().getTestPage()
......
......@@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.0"
version: "5.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.39.10"
version: "0.39.11"
app_settings:
dependency: "direct main"
description:
......@@ -453,7 +453,7 @@ packages:
name: path_provider_linux
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+1"
version: "0.0.1+2"
path_provider_macos:
dependency: transitive
description:
......@@ -731,7 +731,7 @@ packages:
name: url_launcher_web
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.1+6"
version: "0.1.2"
uuid:
dependency: transitive
description:
......
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