Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gm_flutter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林生雨
gm_flutter
Commits
b08c33b5
Commit
b08c33b5
authored
Jul 04, 2020
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
1e0d0eeb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
631 additions
and
430 deletions
+631
-430
LevelOneList.dart
lib/ClueModel/page/levelOne/LevelOneList.dart
+101
-0
LevelOneListModel.dart
lib/ClueModel/page/levelOne/LevelOneListModel.dart
+68
-0
LevelOneModel.dart
lib/ClueModel/page/levelOne/LevelOneModel.dart
+27
-57
LevelOnePage.dart
lib/ClueModel/page/levelOne/LevelOnePage.dart
+367
-323
PlanOverViewBean.dart
lib/ClueModel/server/entity/PlanOverViewBean.dart
+5
-5
BaseComponent.dart
lib/commonModel/base/BaseComponent.dart
+63
-45
No files found.
lib/ClueModel/page/levelOne/LevelOneList.dart
0 → 100644
View file @
b08c33b5
/*
* @author lsy
* @date 2020/7/4
**/
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:gm_flutter/ClueModel/page/levelOne/LevelOneListModel.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:pull_to_refresh/pull_to_refresh.dart'
;
import
'LevelOneItem.dart'
;
class
LevelOneList
extends
StatefulWidget
{
double
topHeight
;
int
planId
;
String
tabName
;
LevelOneList
(
this
.
planId
,
this
.
tabName
,
this
.
topHeight
);
@override
State
<
StatefulWidget
>
createState
()
=>
LevelOneListState
();
}
class
LevelOneListState
extends
State
<
LevelOneList
>
{
LevelOneListModel
_model
=
LevelOneListModel
();
RefreshController
refreshController
=
RefreshController
();
@override
void
initState
()
{
super
.
initState
();
_model
.
plan_id
=
widget
.
planId
;
_model
.
tab_type
=
widget
.
tabName
;
_model
.
refreshView
(
true
);
}
@override
void
dispose
()
{
refreshController
.
dispose
();
_model
.
dispose
();
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
baseStateView
(
MediaQuery
.
of
(
context
).
size
.
width
,
MediaQuery
.
of
(
context
).
size
.
height
,
_model
.
stateLive
,
pages
(),
()
{
_model
.
refreshView
(
true
);
},
paddingTop:
widget
.
topHeight
);
}
Widget
pages
()
{
return
baseRefreshView
(
refreshController
,
()
{},
null
,
null
,
customScrollView:
CustomScrollView
(
// physics: NeverScrollableScrollPhysics(),
physics:
ClampingScrollPhysics
(),
// shrinkWrap: true,
slivers:
<
Widget
>[
SliverOverlapInjector
(
handle:
NestedScrollView
.
sliverOverlapAbsorberHandleFor
(
context
),
),
StreamBuilder
<
List
<
Cards
>>(
stream:
_model
.
cardsLive
.
stream
,
initialData:
_model
.
cardsLive
.
data
??
[],
builder:
(
c
,
data
)
{
if
(
data
.
data
.
isEmpty
&&
_model
.
page
>
1
)
{
refreshController
.
loadNoData
();
}
else
{
refreshController
.
loadComplete
();
}
return
SliverList
(
delegate:
SliverChildBuilderDelegate
(
(
BuildContext
context
,
int
index
)
{
return
LevelOneItem
(
_model
.
data
[
index
]);
},
childCount:
_model
.
data
.
length
,
),
);
},
),
StreamBuilder
<
List
<
Cards
>>(
stream:
_model
.
cardsLive
.
stream
,
initialData:
_model
.
data
??
[],
builder:
(
c
,
data
)
{
double
height
=
MediaQuery
.
of
(
context
).
size
.
height
-
40
-
widget
.
topHeight
-
100
*
_model
.
data
.
length
;
return
SliverToBoxAdapter
(
child:
Container
(
height:
height
<
0
?
0
:
height
,
),
);
},
),
],
),
onLoading:
()
{
_model
.
loadMore
();
},
pullDown:
false
,
pullUp:
true
);
}
}
lib/ClueModel/page/levelOne/LevelOneListModel.dart
0 → 100644
View file @
b08c33b5
/*
* @author lsy
* @date 2020/7/4
**/
import
'package:flutter_common/commonModel/live/BaseModel.dart'
;
import
'package:flutter_common/commonModel/live/LiveData.dart'
;
import
'package:flutter_common/commonModel/toast/NativeToast.dart'
;
import
'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
import
'package:gm_flutter/commonModel/bean/Pair.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'
;
import
'package:pull_to_refresh/pull_to_refresh.dart'
;
class
LevelOneListModel
extends
BaseModel
{
int
plan_id
;
String
tab_type
;
int
page
=
1
;
LiveData
<
int
>
stateLive
=
LiveData
();
LiveData
<
List
<
Cards
>>
cardsLive
=
LiveData
();
List
<
Cards
>
data
=
[];
RxDispose
rxDispose
=
RxDispose
();
void
refreshView
(
bool
clear
,
{
RefreshController
refreshListener
})
{
if
(
clear
)
{
data
.
clear
();
page
=
1
;
}
ClueApiImpl
.
getInstance
()
.
getLevelOneList
(
DioUtil
.
getInstance
().
getDio
(),
plan_id
,
tab_type
,
page
)
.
listen
((
event
)
{
if
(
event
.
error
==
0
)
{
if
((
event
.
data
.
cards
==
null
||
event
.
data
.
cards
.
isEmpty
)
&&
page
==
1
)
{
stateLive
.
notifyView
(
EMPTY
);
}
else
{
data
.
addAll
(
event
.
data
.
cards
);
cardsLive
.
notifyView
(
data
);
stateLive
.
notifyView
(
ENDLOADING
);
}
}
else
{
NativeToast
.
showNativeToast
(
event
.
message
);
stateLive
.
notifyView
(
FAIL
);
}
})
.
addToDispose
(
rxDispose
)
.
onError
((
err
)
{
PrintUtil
.
printBug
(
err
);
stateLive
.
notifyView
(
FAIL
);
});
}
@override
void
dispose
()
{
rxDispose
.
dispose
();
stateLive
.
dispost
();
cardsLive
.
dispost
();
}
void
loadMore
()
{
page
++;
refreshView
(
false
);
}
}
lib/ClueModel/page/levelOne/LevelOneModel.dart
View file @
b08c33b5
...
@@ -5,8 +5,10 @@
...
@@ -5,8 +5,10 @@
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_common/commonModel/live/BaseModel.dart'
;
import
'package:flutter_common/commonModel/live/BaseModel.dart'
;
import
'package:flutter_common/commonModel/live/LiveData.dart'
;
import
'package:flutter_common/commonModel/live/LiveData.dart'
;
import
'package:flutter_common/commonModel/toast/NativeToast.dart'
;
import
'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart'
;
import
'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanOverViewBean.dart'
;
import
'package:gm_flutter/commonModel/GMBase.dart'
;
import
'package:gm_flutter/commonModel/GMBase.dart'
;
import
'package:gm_flutter/commonModel/bean/Pair.dart'
;
import
'package:gm_flutter/commonModel/bean/Pair.dart'
;
import
'package:gm_flutter/commonModel/rx/RxDispose.dart'
;
import
'package:gm_flutter/commonModel/rx/RxDispose.dart'
;
...
@@ -15,64 +17,45 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
...
@@ -15,64 +17,45 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
class
LevelOneModel
extends
BaseModel
{
class
LevelOneModel
extends
BaseModel
{
LiveData
<
double
>
appBarLive
=
LiveData
();
LiveData
<
double
>
appBarLive
=
LiveData
();
LiveData
<
List
<
String
>>
rectLive
=
LiveData
();
LiveData
<
List
<
String
>>
explainLive
=
LiveData
();
LiveData
<
bool
>
showTab
=
LiveData
();
LiveData
<
bool
>
showTab
=
LiveData
();
LiveData
<
int
>
topIndexLive
=
new
LiveData
();
LiveData
<
int
>
topIndexLive
=
new
LiveData
();
LiveData
<
double
>
topScrollLive
=
new
LiveData
();
LiveData
<
double
>
topScrollLive
=
new
LiveData
();
LiveData
<
bool
>
loadingLive
=
LiveData
();
LiveData
<
int
>
stateLive
=
LiveData
();
LiveData
<
double
>
textLive
=
LiveData
();
RxDispose
rxDispose
=
RxDispose
();
RxDispose
rxDispose
=
RxDispose
();
LiveData
<
Pair
<
int
,
List
<
Cards
>>>
cardsLive
=
LiveData
();
LiveData
<
Pair
<
int
,
List
<
Cards
>>>
cardsLive
=
LiveData
();
Map
<
int
,
List
<
Cards
>>
data
=
new
Map
();
Map
<
int
,
List
<
Cards
>>
data
=
new
Map
();
List
list
=
[
"plan"
,
"hospital"
,
"doctor"
,
"diary"
];
List
list
=
[
"plan"
,
"hospital"
,
"doctor"
,
"diary"
];
List
<
Tabs
>
tabsList
=
[];
List
pageList
=
[
1
,
1
,
1
,
1
];
List
pageList
=
[
1
,
1
,
1
,
1
];
List
pageHeightList
=
[
118
,
149
,
118
,
118
];
List
pageHeightList
=
[
118
,
149
,
118
,
118
];
int
plan_id
=
0
;
PlanOverData
planoverItem
;
void
refreshView
(
bool
clear
,
{
RefreshController
refreshListener
})
{
void
init
(
VoidCallback
callback
)
{
Future
.
delayed
(
Duration
(
seconds:
1
),
()
{
Cards
cards
=
Cards
(
cardType:
"plan"
,
plan:
Plan
(
planName:
"ww"
,
minPrice:
"50"
,
maxPrice:
"500"
));
List
<
Cards
>
a
=
[
cards
,
cards
,
cards
,
cards
,
cards
,
cards
,
cards
,
cards
,
cards
,
cards
,
cards
,
cards
,
];
List
<
Cards
>
b
=
[
cards
];
print
(
"INDEX
${currentIndex}
"
);
if
(
currentIndex
==
1
)
{
data
[
currentIndex
]
=
b
;
}
else
{
data
[
currentIndex
]
=
a
;
}
cardsLive
.
notifyView
(
Pair
(
ENDLOADING
,
data
));
});
int
index
=
currentIndex
;
if
(
clear
)
{
data
.
clear
();
pageList
=
[
1
,
1
,
1
,
1
];
}
ClueApiImpl
.
getInstance
()
ClueApiImpl
.
getInstance
()
.
getLevelOneList
(
.
getPlanOverView
(
DioUtil
.
getInstance
().
getDio
(),
plan_id
)
DioUtil
.
getInstance
().
getDio
(),
123
,
list
[
index
],
pageList
[
index
])
.
listen
((
event
)
{
.
listen
((
event
)
{})
if
(
event
.
error
==
0
)
{
planoverItem
=
event
.
data
;
tabsList
=
event
.
data
.
tabs
;
stateLive
.
notifyView
(
ENDLOADING
);
callback
();
}
else
{
NativeToast
.
showNativeToast
(
event
.
message
);
stateLive
.
notifyView
(
FAIL
);
}
})
.
addToDispose
(
rxDispose
)
.
addToDispose
(
rxDispose
)
.
onError
((
err
)
{
.
onError
((
err
)
{
PrintUtil
.
printBug
(
err
);
PrintUtil
.
printBug
(
err
);
});
stateLive
.
notifyView
(
FAIL
);
});
}
}
int
currentIndex
=
0
;
int
currentIndex
=
0
;
@override
@override
...
@@ -80,26 +63,13 @@ class LevelOneModel extends BaseModel {
...
@@ -80,26 +63,13 @@ class LevelOneModel extends BaseModel {
showTab
.
dispost
();
showTab
.
dispost
();
cardsLive
.
dispost
();
cardsLive
.
dispost
();
appBarLive
.
dispost
();
appBarLive
.
dispost
();
rectLive
.
dispost
();
topIndexLive
.
dispost
();
topIndexLive
.
dispost
();
topScrollLive
.
dispost
();
topScrollLive
.
dispost
();
loadingLive
.
dispost
();
stateLive
.
dispost
();
}
textLive
.
dispost
();
void
selectPage
(
int
index
)
{
if
(
currentIndex
==
index
)
{
return
;
}
currentIndex
=
index
;
if
(
data
[
currentIndex
]
==
null
)
{
cardsLive
.
notifyView
(
Pair
(
LOADING
,
null
));
refreshView
(
true
);
}
else
{
cardsLive
.
notifyView
(
Pair
(
ENDLOADING
,
data
[
currentIndex
]));
}
}
}
void
loadMore
(
)
{
void
selectTab
(
int
index
)
{
}
}
}
}
lib/ClueModel/page/levelOne/LevelOnePage.dart
View file @
b08c33b5
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
* @date 2020/6/29
* @date 2020/6/29
**/
**/
import
'dart:math'
;
import
'dart:math'
;
import
'dart:ui'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/gestures.dart'
;
...
@@ -10,7 +11,9 @@ import 'package:flutter/material.dart';
...
@@ -10,7 +11,9 @@ import 'package:flutter/material.dart';
import
'package:flutter_boost/flutter_boost.dart'
;
import
'package:flutter_boost/flutter_boost.dart'
;
import
'package:flutter_common/commonModel/live/LiveData.dart'
;
import
'package:flutter_common/commonModel/live/LiveData.dart'
;
import
'package:gm_flutter/ClueModel/page/levelOne/LevelOneItem.dart'
;
import
'package:gm_flutter/ClueModel/page/levelOne/LevelOneItem.dart'
;
import
'package:gm_flutter/ClueModel/page/levelOne/LevelOneList.dart'
;
import
'package:gm_flutter/ClueModel/page/levelOne/LevelOneModel.dart'
;
import
'package:gm_flutter/ClueModel/page/levelOne/LevelOneModel.dart'
;
import
'package:gm_flutter/ClueModel/page/levelTwo/LevelTwoPage.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
import
'package:gm_flutter/ClueModel/util/PosUtil.dart'
;
import
'package:gm_flutter/ClueModel/util/PosUtil.dart'
;
import
'package:gm_flutter/ClueModel/view/FiveStarView.dart'
;
import
'package:gm_flutter/ClueModel/view/FiveStarView.dart'
;
...
@@ -27,8 +30,8 @@ class LevelOnePage extends StatefulWidget {
...
@@ -27,8 +30,8 @@ class LevelOnePage extends StatefulWidget {
State
<
StatefulWidget
>
createState
()
=>
LevelOneState
();
State
<
StatefulWidget
>
createState
()
=>
LevelOneState
();
}
}
class
LevelOneState
extends
BaseState
<
LevelOnePage
>
class
LevelOneState
extends
BaseState
<
LevelOnePage
>
{
with
TickerProviderStateMixin
{
int
planId
=
10
;
LevelOneModel
_model
=
new
LevelOneModel
();
LevelOneModel
_model
=
new
LevelOneModel
();
RefreshController
_refreshController
=
RefreshController
();
RefreshController
_refreshController
=
RefreshController
();
PageController
pageController
=
new
PageController
();
PageController
pageController
=
new
PageController
();
...
@@ -41,26 +44,16 @@ class LevelOneState extends BaseState<LevelOnePage>
...
@@ -41,26 +44,16 @@ class LevelOneState extends BaseState<LevelOnePage>
@override
@override
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
Future
.
delayed
(
Duration
(
seconds:
3
),
()
{
_model
.
init
(()
{
_model
.
loadingLive
.
notifyView
(
false
);
setState
(()
{});
_model
.
refreshView
(
true
);
});
});
pageController
.
addListener
(()
{
if
(
screenWidth
!=
null
)
{
// pageController.addListener(() {
_model
.
topScrollLive
.
notifyView
(
// if (screenWidth != null) {
pageController
.
offset
/
screenWidth
*
(
screenWidth
/
4
));
// _model.topScrollLive.notifyView(
}
// pageController.offset / screenWidth * (screenWidth / 4));
});
// }
oneList
.
add
(
head
());
// });
oneList
.
add
(
good
());
oneList
.
add
(
rect
());
oneList
.
add
(
explain
());
oneList
.
add
(
Container
(
height:
5
,
color:
Color
(
0xffF7F6FA
),
));
oneList
.
add
(
feed
());
oneList
.
add
(
pages
());
}
}
void
_onScroll
(
double
offset
)
{
void
_onScroll
(
double
offset
)
{
...
@@ -104,176 +97,127 @@ class LevelOneState extends BaseState<LevelOnePage>
...
@@ -104,176 +97,127 @@ class LevelOneState extends BaseState<LevelOnePage>
@override
@override
Widget
buildItem
(
BuildContext
context
)
{
Widget
buildItem
(
BuildContext
context
)
{
oneList
.
clear
();
oneList
.
add
(
good
());
oneList
.
add
(
rect
());
oneList
.
add
(
explain
());
oneList
.
add
(
Container
(
height:
5
,
color:
Color
(
0xffF7F6FA
),
));
screenWidth
=
MediaQuery
.
of
(
context
).
size
.
width
;
screenWidth
=
MediaQuery
.
of
(
context
).
size
.
width
;
return
Scaffold
(
return
Scaffold
(
backgroundColor:
Colors
.
white
,
backgroundColor:
Colors
.
white
,
body:
SafeArea
(
body:
SafeArea
(
top:
false
,
top:
false
,
child:
StreamBuilder
<
bool
>(
child:
baseStateView
(
stream:
_model
.
loadingLive
.
stream
,
MediaQuery
.
of
(
context
).
size
.
width
,
initialData:
true
,
MediaQuery
.
of
(
context
).
size
.
height
,
builder:
(
c
,
data
)
{
_model
.
stateLive
,
if
(
data
.
data
)
{
newHomeWarp
(),
()
{
return
loadingItem
();
_model
.
init
(()
{
}
else
{
setState
(()
{});
return
home
();
});
})));
}
Widget
newHomeWarp
()
{
return
Stack
(
children:
<
Widget
>[
Container
(
width:
MediaQuery
.
of
(
context
).
size
.
width
,
height:
MediaQuery
.
of
(
context
).
size
.
height
,
child:
NotificationListener
(
onNotification:
(
scrollNotification
)
{
if
(
scrollNotification
is
KeepAliveNotification
||
scrollNotification
is
OverscrollIndicatorNotification
)
{
return
false
;
}
if
(
scrollNotification
is
ScrollUpdateNotification
&&
scrollNotification
.
metrics
.
axisDirection
.
index
==
2
)
{}
if
(
scrollNotification
.
depth
==
0
)
{
if
(
scrollNotification
.
metrics
.
pixels
>
80
)
{
_model
.
textLive
.
notifyView
(
(
scrollNotification
.
metrics
.
pixels
-
80
)
/
40
>
1.0
?
1.0
:
(
scrollNotification
.
metrics
.
pixels
-
80
)
/
40
);
}
else
{
_model
.
textLive
.
notifyView
(
0.0
);
}
}
else
if
(
scrollNotification
.
depth
==
2
)
{
if
(
scrollNotification
.
metrics
.
pixels
<
50
&&
scrollNotification
.
metrics
.
pixels
>
0
)
{
_model
.
textLive
.
notifyView
(
1.0
);
}
}
}
return
false
;
},
},
)));
child:
newHome
(),
)),
baseSliverTitle
(
"title"
,
MediaQuery
.
of
(
context
).
size
.
width
,
_model
.
textLive
),
baseSliverBack
(()
{
Navigator
.
of
(
context
).
pop
();
}),
],
);
}
}
Widget
home
()
{
Widget
newHome
()
{
return
Column
(
List
<
Widget
>
list
=
[];
children:
<
Widget
>[
var
d
=
MediaQueryData
.
fromWindow
(
window
).
padding
.
top
;
Expanded
(
for
(
int
i
=
0
;
i
<
_model
.
tabsList
.
length
;
i
++)
{
child:
Stack
(
list
.
add
(
children:
<
Widget
>[
LevelOneList
(
planId
,
_model
.
tabsList
[
i
].
tabType
,
kToolbarHeight
+
d
).
toActive
());
MediaQuery
.
removePadding
(
}
removeTop:
true
,
final
double
statusBarHeight
=
MediaQuery
.
of
(
context
).
padding
.
top
;
context:
context
,
final
double
pinnedHeaderHeight
=
statusBarHeight
+
kToolbarHeight
;
child:
NotificationListener
(
return
DefaultTabController
(
onNotification:
(
scrollNotification
)
{
length:
_model
.
tabsList
.
length
,
if
(
scrollNotification
is
ScrollUpdateNotification
&&
child:
NestedScrollView
(
scrollNotification
.
metrics
.
axisDirection
.
index
==
2
)
{
headerSliverBuilder:
_onScroll
(
scrollNotification
.
metrics
.
pixels
);
(
BuildContext
context
,
bool
innerBoxIsScrolled
)
{
return
<
Widget
>[
SliverOverlapAbsorber
(
handle:
NestedScrollView
.
sliverOverlapAbsorberHandleFor
(
context
),
sliver:
baseSliverAppBar
(
// _model.imageUrl
"https://pic.igengmei.com/2018/09/11/1513/b7e825a4e4c1-w"
)),
SliverList
(
delegate:
SliverChildBuilderDelegate
((
BuildContext
c
,
int
i
)
{
if
(
i
==
0
){
return
Container
(
height:
pinnedHeaderHeight
,
);
}
}
return
false
;
return
oneList
[
i
-
1
];
},
},
childCount:
oneList
.
length
+
1
)),
child:
baseRefreshView
(
SliverPersistentHeader
(
_refreshController
,
pinned:
true
,
()
{
delegate:
StickyTabBarDelegate
(
//TODO
child:
Container
(
// _refreshController.refreshCompleted();
},
null
,
null
,
customScrollView:
CustomScrollView
(
slivers:
<
Widget
>[
SliverList
(
delegate:
SliverChildBuilderDelegate
(
(
BuildContext
context
,
int
index
)
{
return
oneList
[
index
];
},
childCount:
oneList
.
length
,
),
),
],
),
pullUp:
true
,
onLoading:
()
{
_model
.
loadMore
();
},
),
)),
StreamBuilder
<
double
>(
stream:
_model
.
appBarLive
.
stream
,
initialData:
_model
.
appBarLive
.
data
??
0.0
,
builder:
(
c
,
data
)
{
return
Opacity
(
opacity:
data
.
data
,
child:
Container
(
height:
86
,
decoration:
BoxDecoration
(
color:
Colors
.
white
),
child:
Center
(
child:
Padding
(
padding:
EdgeInsets
.
only
(
top:
20
),
child:
Text
(
'文案'
),
),
),
),
);
},
),
Positioned
(
top:
86
,
child:
StreamBuilder
<
bool
>(
stream:
_model
.
showTab
.
stream
,
initialData:
_model
.
showTab
.
data
??
false
,
builder:
(
c
,
data
)
{
return
Visibility
(
visible:
data
.
data
,
child:
Container
(
width:
MediaQuery
.
of
(
context
).
size
.
width
,
color:
Colors
.
white
,
child:
MessageBarView
(
topIndexLive:
_model
.
topIndexLive
,
topScrollLive:
_model
.
topScrollLive
,
pageController:
pageController
,
),
));
},
),
),
baseSliverBack
(()
{
Navigator
.
of
(
context
).
pop
();
})
],
),
),
Container
(
height:
0.5
,
width:
double
.
maxFinite
,
color:
Color
(
0xffE5E5E5
),
),
Container
(
width:
double
.
maxFinite
,
height:
55
,
child:
Row
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
Container
(
margin:
EdgeInsets
.
only
(
left:
18
),
width:
30
,
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
Container
(
width:
22
,
height:
22
,
child:
Image
.
asset
(
"assets/vs_black.png"
),
),
Container
(
margin:
EdgeInsets
.
only
(
top:
3
),
child:
baseText
(
"去比较"
,
10
,
Color
(
0xff282828
)),
)
],
),
),
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
onTap:
()
{},
child:
Container
(
margin:
EdgeInsets
.
only
(
left:
15
),
width:
135
,
height:
40
,
height:
40
,
decoration:
BoxDecoration
(
color:
Colors
.
white
,
color:
Color
(
0xff51CDC7
),
child:
baseTabBar
(
null
,
getTabs
(),
(
index
)
{
borderRadius:
BorderRadius
.
circular
(
20
)),
_model
.
selectTab
(
index
);
alignment:
Alignment
.
center
,
},
scroll:
false
),
child:
baseText
(
"咨询"
,
14
,
Colors
.
white
,
bold:
true
),
)),
)),
GestureDetector
(
),
behavior:
HitTestBehavior
.
opaque
,
];
onTap:
()
{},
},
child:
Container
(
body:
TabBarView
(
children:
list
)));
margin:
EdgeInsets
.
only
(
left:
15
),
}
width:
135
,
height:
40
,
List
<
Widget
>
getTabs
()
{
decoration:
BoxDecoration
(
List
<
Widget
>
list
=
[];
color:
Color
(
0xffF96079
),
for
(
int
i
=
0
;
i
<
_model
.
tabsList
.
length
;
i
++)
{
borderRadius:
BorderRadius
.
circular
(
20
)),
list
.
add
(
baseTabBarItem
(
_model
.
tabsList
[
i
].
name
,
alignment:
Alignment
.
center
,
leftPadding:
i
==
0
?
24
:
28
,
child:
baseText
(
"获取底价"
,
14
,
Colors
.
white
,
bold:
true
),
rightPadding:
i
==
_model
.
tabsList
.
length
-
1
?
24
:
28
));
)),
}
Expanded
(
return
list
;
child:
Container
(),
)
],
),
)
],
);
}
}
Widget
head
()
{
Widget
head
()
{
...
@@ -292,8 +236,13 @@ class LevelOneState extends BaseState<LevelOnePage>
...
@@ -292,8 +236,13 @@ class LevelOneState extends BaseState<LevelOnePage>
}
}
Widget
good
()
{
Widget
good
()
{
if
(
_model
.
planoverItem
==
null
)
{
return
Container
(
height:
54
,
);
}
return
Container
(
return
Container
(
width:
double
.
maxFinite
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
height:
54
,
height:
54
,
margin:
EdgeInsets
.
only
(
top:
18
,
bottom:
12
),
margin:
EdgeInsets
.
only
(
top:
18
,
bottom:
12
),
child:
Stack
(
child:
Stack
(
...
@@ -301,12 +250,14 @@ class LevelOneState extends BaseState<LevelOnePage>
...
@@ -301,12 +250,14 @@ class LevelOneState extends BaseState<LevelOnePage>
Positioned
(
Positioned
(
top:
6
,
top:
6
,
left:
15
,
left:
15
,
child:
baseText
(
"TODO"
,
18
,
Color
(
0xff282828
),
bold:
true
),
child:
baseText
(
_model
.
planoverItem
.
name
,
18
,
Color
(
0xff282828
),
bold:
true
),
),
),
Positioned
(
Positioned
(
bottom:
8
,
bottom:
8
,
left:
15
,
left:
15
,
child:
baseText
(
"TODO"
,
12
,
Color
(
0xff999999
)),
child:
baseText
(
_model
.
planoverItem
.
planDescription
,
12
,
Color
(
0xff999999
)),
),
),
Positioned
(
Positioned
(
right:
0
,
right:
0
,
...
@@ -331,16 +282,18 @@ class LevelOneState extends BaseState<LevelOnePage>
...
@@ -331,16 +282,18 @@ class LevelOneState extends BaseState<LevelOnePage>
baseText
(
"好评率"
,
11
,
Color
(
0xff282828
)),
baseText
(
"好评率"
,
11
,
Color
(
0xff282828
)),
Container
(
Container
(
margin:
EdgeInsets
.
only
(
left:
4
),
margin:
EdgeInsets
.
only
(
left:
4
),
child:
baseText
(
"99"
,
20
,
Color
(
0xffFF5963
)),
child:
baseText
(
"
${_model.planoverItem.positiveRate}
"
,
20
,
Color
(
0xffFF5963
)),
),
),
baseText
(
"%"
,
11
,
Color
(
0xffFF5963
)),
//
baseText("%", 11, Color(0xffFF5963)),
],
],
),
),
),
),
Positioned
(
Positioned
(
right:
15
,
right:
15
,
bottom:
8
,
bottom:
8
,
child:
baseText
(
"销量110"
,
11
,
Color
(
0xff666666
)),
child:
baseText
(
"销量
${_model.planoverItem.salesCount}
"
,
11
,
Color
(
0xff666666
)),
)
)
],
],
),
),
...
@@ -348,96 +301,93 @@ class LevelOneState extends BaseState<LevelOnePage>
...
@@ -348,96 +301,93 @@ class LevelOneState extends BaseState<LevelOnePage>
}
}
Widget
rect
()
{
Widget
rect
()
{
return
StreamBuilder
<
List
<
String
>>(
if
(
_model
.
planoverItem
==
null
)
{
stream:
_model
.
rectLive
.
stream
,
return
Container
(
initialData:
[
"w"
,
"w"
,
"q"
,
"w"
],
height:
62
,
builder:
(
c
,
data
)
{
);
List
<
Widget
>
list
=
List
();
}
for
(
int
i
=
0
;
i
<
data
.
data
.
length
;
i
+=
2
)
{
List
<
Widget
>
list
=
List
();
list
.
add
(
Expanded
(
int
i
=
0
;
child:
Container
(
_model
.
planoverItem
.
overviewAttrs
.
forEach
((
element
)
{
alignment:
Alignment
.
center
,
list
.
add
(
Expanded
(
child:
Column
(
child:
Container
(
mainAxisSize:
MainAxisSize
.
min
,
alignment:
Alignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
child:
Column
(
children:
<
Widget
>[
mainAxisSize:
MainAxisSize
.
min
,
baseText
(
data
.
data
[
i
],
14
,
Color
(
0xff282828
),
bold:
true
),
baseText
(
data
.
data
[
i
+
1
],
11
,
Color
(
0xff999999
)),
],
),
),
));
if
(
i
<
data
.
data
.
length
-
2
)
{
list
.
add
(
Container
(
width:
0.5
,
height:
18
,
color:
Color
(
0xFFE5E5E5
),
));
}
}
return
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
4
),
color:
Color
(
0xffF9F8FB
),
),
width:
double
.
maxFinite
,
height:
62
,
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
,
bottom:
20
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
list
,
children:
<
Widget
>[
baseText
(
element
.
attrName
,
14
,
Color
(
0xff282828
),
bold:
true
),
baseText
(
element
.
attrValue
,
11
,
Color
(
0xff999999
)),
],
),
),
);
),
},
));
if
(
i
!=
_model
.
planoverItem
?.
overviewAttrs
.
length
-
1
)
{
list
.
add
(
Container
(
width:
0.5
,
height:
18
,
color:
Color
(
0xFFE5E5E5
),
));
}
i
++;
});
return
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
4
),
color:
Color
(
0xffF9F8FB
),
),
width:
double
.
maxFinite
,
height:
62
,
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
,
bottom:
20
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
list
,
),
);
);
}
}
Widget
explain
()
{
Widget
explain
()
{
return
StreamBuilder
<
List
<
String
>>(
List
<
Widget
>
list
=
[];
stream:
_model
.
explainLive
.
stream
,
list
.
add
(
Container
(
initialData:
[
"www"
,
"www"
,
"www"
,
"??"
],
height:
31
,
builder:
(
c
,
data
)
{
child:
Row
(
List
<
Widget
>
list
=
[];
children:
<
Widget
>[
baseText
(
"项目说明"
,
15
,
Color
(
0xff282828
)),
Expanded
(
child:
Container
(),
),
GestureDetector
(
onTap:
()
{
//TODO
},
behavior:
HitTestBehavior
.
opaque
,
child:
baseText
(
"了解更多"
,
12
,
Color
(
0xff3FB5AF
)),
)
],
),
));
if
(
_model
.
planoverItem
!=
null
)
{
_model
.
planoverItem
.
explanationAttrs
.
forEach
((
element
)
{
list
.
add
(
Container
(
list
.
add
(
Container
(
height:
31
,
height:
28
,
child:
Row
(
child:
Row
(
children:
<
Widget
>[
children:
<
Widget
>[
baseText
(
"项目说明"
,
15
,
Color
(
0xff282828
)),
baseText
(
element
.
attrName
,
13
,
Color
(
0xff999999
)),
Expanded
(
Container
(
child:
Container
(),
margin:
EdgeInsets
.
only
(
left:
12
),
),
child:
baseText
(
element
.
attrValue
,
13
,
Color
(
0xff666666
)),
GestureDetector
(
onTap:
()
{
//TODO
},
behavior:
HitTestBehavior
.
opaque
,
child:
baseText
(
"了解更多"
,
12
,
Color
(
0xff3FB5AF
)),
)
)
],
],
),
),
));
));
for
(
int
i
=
0
;
i
<
data
.
data
.
length
;
i
+=
2
)
{
});
list
.
add
(
Container
(
}
height:
28
,
return
Container
(
child:
Row
(
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
,
bottom:
20
),
children:
<
Widget
>[
child:
Column
(
baseText
(
data
.
data
[
i
],
13
,
Color
(
0xff999999
)),
mainAxisSize:
MainAxisSize
.
min
,
Container
(
children:
list
,
margin:
EdgeInsets
.
only
(
left:
12
),
),
child:
baseText
(
data
.
data
[
i
+
1
],
13
,
Color
(
0xff666666
)),
)
],
),
));
}
return
Container
(
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
,
bottom:
20
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
list
,
),
);
},
);
);
}
}
...
@@ -451,65 +401,159 @@ class LevelOneState extends BaseState<LevelOnePage>
...
@@ -451,65 +401,159 @@ class LevelOneState extends BaseState<LevelOnePage>
));
));
}
}
Widget
pages
()
{
// Widget home() {
return
StreamBuilder
<
Pair
<
int
,
List
<
Cards
>>>(
// return Column(
stream:
_model
.
cardsLive
.
stream
,
// children: <Widget>[
initialData:
_model
.
cardsLive
.
data
??
Pair
(
LOADING
,
null
),
// Expanded(
builder:
(
c
,
data
)
{
// child: Stack(
double
height
=
MediaQuery
.
of
(
context
).
size
.
height
-
86
-
55.5
-
49
;
// children: <Widget>[
if
(
_model
.
data
[
_model
.
currentIndex
]
!=
null
&&
// MediaQuery.removePadding(
_model
.
data
[
_model
.
currentIndex
].
length
>
0
)
{
// removeTop: true,
height
=
max
(
// context: context,
_model
.
data
[
_model
.
currentIndex
].
length
*
// child: NotificationListener(
_model
.
pageHeightList
[
_model
.
currentIndex
]
*
// onNotification: (scrollNotification) {
1.0
,
// if (scrollNotification is ScrollUpdateNotification &&
height
);
// scrollNotification.metrics.axisDirection.index == 2) {
}
// _onScroll(scrollNotification.metrics.pixels);
return
Container
(
// }
width:
double
.
maxFinite
,
// return false;
height:
height
,
// },
child:
PageView
.
builder
(
// child: baseRefreshView(
itemBuilder:
(
c
,
pageIndex
)
{
// _refreshController,
if
(
data
.
data
.
first
==
FAIL
)
{
// () {
return
errorItem
(
MediaQuery
.
of
(
context
).
size
.
width
,
height
,
()
{
// //TODO
_model
.
refreshView
(
true
);
//// _refreshController.refreshCompleted();
});
// },
}
// null,
if
(
data
.
data
.
first
==
LOADING
||
// null,
_model
.
data
[
pageIndex
]
==
null
)
{
// customScrollView: CustomScrollView(
return
loadingItem
();
// slivers: <Widget>[
}
// SliverList(
if
(
data
.
data
.
second
.
length
==
0
)
{
// delegate: SliverChildBuilderDelegate(
if
(
_model
.
pageList
[
pageIndex
]
==
1
)
{
// (BuildContext context, int index) {
return
emptyItem
(
MediaQuery
.
of
(
context
).
size
.
width
,
height
);
// return oneList[index];
}
else
{
// },
_refreshController
.
loadNoData
();
// childCount: oneList.length,
}
// ),
}
else
{
// ),
_refreshController
.
loadComplete
();
// ],
}
// ),
return
ListView
.
builder
(
// pullUp: true,
physics:
NeverScrollableScrollPhysics
(),
// onLoading: () {
itemBuilder:
(
c
,
index
)
{
// _model.loadMore();
return
LevelOneItem
(
_model
.
data
[
pageIndex
][
index
]);
// },
},
// ),
itemCount:
_model
.
data
[
pageIndex
].
length
,
// )),
);
// StreamBuilder<double>(
},
// stream: _model.appBarLive.stream,
allowImplicitScrolling:
false
,
// initialData: _model.appBarLive.data ?? 0.0,
dragStartBehavior:
DragStartBehavior
.
down
,
// builder: (c, data) {
controller:
pageController
,
// return Opacity(
itemCount:
4
,
// opacity: data.data,
onPageChanged:
(
index
)
{
// child: Container(
_refreshController
.
resetNoData
();
// height: 86,
setState
(()
{
// decoration: BoxDecoration(color: Colors.white),
});
// child: Center(
_model
.
topIndexLive
.
notifyView
(
index
);
// child: Padding(
_model
.
selectPage
(
index
);
// padding: EdgeInsets.only(top: 20),
},
// child: Text('文案'),
),
// ),
);
// ),
},
// ),
);
// );
}
// },
// ),
// baseSliverTitle("title", MediaQuery.of(context).size.width,
// _model.appBarLive),
// Positioned(
// top: 86,
// child: StreamBuilder<bool>(
// stream: _model.showTab.stream,
// initialData: _model.showTab.data ?? false,
// builder: (c, data) {
// return Visibility(
// visible: data.data,
// child: Container(
// width: MediaQuery.of(context).size.width,
// color: Colors.white,
// child: MessageBarView(
// topIndexLive: _model.topIndexLive,
// topScrollLive: _model.topScrollLive,
// pageController: pageController,
// ),
// ));
// },
// ),
// ),
// baseSliverBack(() {
// Navigator.of(context).pop();
// })
// ],
// ),
// ),
// Container(
// height: 0.5,
// width: double.maxFinite,
// color: Color(0xffE5E5E5),
// ),
// Container(
// width: double.maxFinite,
// height: 55,
// child: Row(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// Container(
// margin: EdgeInsets.only(left: 18),
// width: 30,
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Container(
// width: 22,
// height: 22,
// child: Image.asset("assets/vs_black.png"),
// ),
// Container(
// margin: EdgeInsets.only(top: 3),
// child: baseText("去比较", 10, Color(0xff282828)),
// )
// ],
// ),
// ),
// GestureDetector(
// behavior: HitTestBehavior.opaque,
// onTap: () {},
// child: Container(
// margin: EdgeInsets.only(left: 15),
// width: 135,
// height: 40,
// decoration: BoxDecoration(
// color: Color(0xff51CDC7),
// borderRadius: BorderRadius.circular(20)),
// alignment: Alignment.center,
// child: baseText("咨询", 14, Colors.white, bold: true),
// )),
// GestureDetector(
// behavior: HitTestBehavior.opaque,
// onTap: () {},
// child: Container(
// margin: EdgeInsets.only(left: 15),
// width: 135,
// height: 40,
// decoration: BoxDecoration(
// color: Color(0xffF96079),
// borderRadius: BorderRadius.circular(20)),
// alignment: Alignment.center,
// child: baseText("获取底价", 14, Colors.white, bold: true),
// )),
// Expanded(
// child: Container(),
// )
// ],
// ),
// )
// ],
// );
// }
}
}
lib/ClueModel/server/entity/PlanOverViewBean.dart
View file @
b08c33b5
...
@@ -8,7 +8,7 @@ class PlanOverViewBean {
...
@@ -8,7 +8,7 @@ class PlanOverViewBean {
Null
extra
;
Null
extra
;
Null
errorExtra
;
Null
errorExtra
;
UserType
userType
;
UserType
userType
;
Data
data
;
PlanOver
Data
data
;
PlanOverViewBean
(
PlanOverViewBean
(
{
this
.
error
,
{
this
.
error
,
...
@@ -26,7 +26,7 @@ class PlanOverViewBean {
...
@@ -26,7 +26,7 @@ class PlanOverViewBean {
userType
=
json
[
'user_type'
]
!=
null
userType
=
json
[
'user_type'
]
!=
null
?
new
UserType
.
fromJson
(
json
[
'user_type'
])
?
new
UserType
.
fromJson
(
json
[
'user_type'
])
:
null
;
:
null
;
data
=
json
[
'data'
]
!=
null
?
new
Data
.
fromJson
(
json
[
'data'
])
:
null
;
data
=
json
[
'data'
]
!=
null
?
new
PlanOver
Data
.
fromJson
(
json
[
'data'
])
:
null
;
}
}
Map
<
String
,
dynamic
>
toJson
()
{
Map
<
String
,
dynamic
>
toJson
()
{
...
@@ -56,7 +56,7 @@ class UserType {
...
@@ -56,7 +56,7 @@ class UserType {
}
}
}
}
class
Data
{
class
PlanOver
Data
{
Banner
banner
;
Banner
banner
;
String
name
;
String
name
;
String
positiveRate
;
String
positiveRate
;
...
@@ -67,7 +67,7 @@ class Data {
...
@@ -67,7 +67,7 @@ class Data {
List
<
ExplanationAttrs
>
explanationAttrs
;
List
<
ExplanationAttrs
>
explanationAttrs
;
List
<
Tabs
>
tabs
;
List
<
Tabs
>
tabs
;
Data
(
PlanOver
Data
(
{
this
.
banner
,
{
this
.
banner
,
this
.
name
,
this
.
name
,
this
.
positiveRate
,
this
.
positiveRate
,
...
@@ -78,7 +78,7 @@ class Data {
...
@@ -78,7 +78,7 @@ class Data {
this
.
explanationAttrs
,
this
.
explanationAttrs
,
this
.
tabs
});
this
.
tabs
});
Data
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
PlanOver
Data
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
banner
=
banner
=
json
[
'banner'
]
!=
null
?
new
Banner
.
fromJson
(
json
[
'banner'
])
:
null
;
json
[
'banner'
]
!=
null
?
new
Banner
.
fromJson
(
json
[
'banner'
])
:
null
;
name
=
json
[
'name'
];
name
=
json
[
'name'
];
...
...
lib/commonModel/base/BaseComponent.dart
View file @
b08c33b5
...
@@ -143,42 +143,49 @@ Widget loadingItem({bool needBackground = false}) {
...
@@ -143,42 +143,49 @@ Widget loadingItem({bool needBackground = false}) {
Widget
netErrorItem
(
)
{}
Widget
netErrorItem
(
)
{}
Widget
errorItem
(
double
width
,
double
height
,
VoidCallback
retry
,
Widget
errorItem
(
double
width
,
double
height
,
VoidCallback
retry
,
{
String
errorText
,
String
retryText
})
{
{
String
errorText
,
String
retryText
,
double
paddingTop
})
{
return
Container
(
return
Container
(
width:
width
,
width:
width
,
height:
height
,
height:
height
,
color:
Colors
.
white
,
padding:
EdgeInsets
.
only
(
top:
paddingTop
)
,
alignment:
Alignment
.
topCenter
,
alignment:
Alignment
.
topCenter
,
child:
Container
(
child:
Container
(
width:
180
,
width:
180
,
height:
315.5
,
height:
315.5
,
margin:
EdgeInsets
.
only
(
top:
62
),
margin:
EdgeInsets
.
only
(
top:
62
),
child:
Stack
(
child:
Column
(
alignment:
AlignmentDirectional
.
center
,
children:
<
Widget
>[
children:
<
Widget
>[
Container
(
Positioned
(
left:
0
,
top:
0
,
child:
Container
(
width:
180
,
width:
180
,
height:
186.5
,
height:
186.5
,
child:
Image
.
asset
(
"assets/error.png"
),
child:
Stack
(
),
alignment:
AlignmentDirectional
.
center
,
),
children:
<
Widget
>[
Positioned
(
Positioned
(
top:
166
,
left:
0
,
child:
Container
(
top:
0
,
width:
180
,
child:
Container
(
alignment:
Alignment
.
center
,
width:
180
,
child:
baseText
(
height:
186.5
,
errorText
??
"原谅我一看到美人就不淡定"
,
15
,
Color
(
0xff666666
)),
child:
Image
.
asset
(
"assets/error.png"
),
),
),
Positioned
(
top:
166
,
child:
Container
(
width:
180
,
alignment:
Alignment
.
center
,
child:
baseText
(
errorText
??
"原谅我一看到美人就不淡定"
,
15
,
Color
(
0xff666666
)),
),
),
],
),
),
),
),
Container
(
Positioned
(
bottom:
60
,
child:
Container
(
width:
150
,
width:
150
,
height:
40
,
height:
40
,
margin:
EdgeInsets
.
only
(
top:
17
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
20
),
borderRadius:
BorderRadius
.
circular
(
20
),
gradient:
LinearGradient
(
gradient:
LinearGradient
(
...
@@ -190,12 +197,10 @@ Widget errorItem(double width, double height, VoidCallback retry,
...
@@ -190,12 +197,10 @@ Widget errorItem(double width, double height, VoidCallback retry,
).
gestureDetector
(()
{
).
gestureDetector
(()
{
retry
();
retry
();
}),
}),
),
Container
(
Positioned
(
bottom:
0
,
child:
Container
(
width:
150
,
width:
150
,
height:
40
,
height:
40
,
margin:
EdgeInsets
.
only
(
top:
20
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
20
),
borderRadius:
BorderRadius
.
circular
(
20
),
border:
Border
.
all
(
color:
Color
(
0xffFF5963
),
width:
0.5
)),
border:
Border
.
all
(
color:
Color
(
0xffFF5963
),
width:
0.5
)),
...
@@ -204,10 +209,8 @@ Widget errorItem(double width, double height, VoidCallback retry,
...
@@ -204,10 +209,8 @@ Widget errorItem(double width, double height, VoidCallback retry,
).
gestureDetector
(()
{
).
gestureDetector
(()
{
AppSettings
.
openWIFISettings
();
AppSettings
.
openWIFISettings
();
}),
}),
)
],
],
)));
),
));
}
}
//TODO
//TODO
...
@@ -373,8 +376,9 @@ Widget normalRefreshHeader() {
...
@@ -373,8 +376,9 @@ Widget normalRefreshHeader() {
);
);
}
}
Widget
emptyItem
(
double
width
,
double
height
,
{
String
detail
})
{
Widget
emptyItem
(
double
width
,
double
height
,
{
String
detail
,
double
paddingTop
})
{
return
Container
(
return
Container
(
padding:
EdgeInsets
.
only
(
top:
paddingTop
),
width:
width
,
width:
width
,
height:
height
,
height:
height
,
color:
Colors
.
white
,
color:
Colors
.
white
,
...
@@ -383,20 +387,34 @@ Widget emptyItem(double width, double height, {String detail}) {
...
@@ -383,20 +387,34 @@ Widget emptyItem(double width, double height, {String detail}) {
width:
175
,
width:
175
,
height:
188
,
height:
188
,
margin:
EdgeInsets
.
only
(
top:
62.5
),
margin:
EdgeInsets
.
only
(
top:
62.5
),
child:
Stack
(
child:
Column
(
alignment:
AlignmentDirectional
.
bottomCenter
,
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
children:
<
Widget
>[
Container
(
Container
(
width:
175
,
width:
175
,
height:
188
,
height:
188
,
child:
Image
.
asset
(
"assets/empty.png"
),
child:
Stack
(
alignment:
AlignmentDirectional
.
bottomCenter
,
children:
<
Widget
>[
Container
(
width:
175
,
height:
188
,
child:
Image
.
asset
(
"assets/empty.png"
),
),
Positioned
(
bottom:
17
,
child:
baseText
(
detail
??
"此处太寂寥,转转别处吧"
,
15
,
Color
(
0xff666666
)),
)
],
),
),
),
Positioned
(
Container
(
bottom:
17
,
height:
0
,
c
hild:
baseText
(
detail
??
"此处太寂寥,转转别处吧"
,
15
,
Color
(
0xff666666
))
,
c
olor:
Colors
.
white
,
)
)
],
],
),
)
),
),
);
);
}
}
...
@@ -491,7 +509,7 @@ Widget baseSliverTitle(String text, double width, LiveData liveData) {
...
@@ -491,7 +509,7 @@ Widget baseSliverTitle(String text, double width, LiveData liveData) {
}
}
Widget
baseStateView
(
double
width
,
double
height
,
LiveData
<
int
>
stateLive
,
Widget
baseStateView
(
double
width
,
double
height
,
LiveData
<
int
>
stateLive
,
Widget
home
,
VoidCallback
retry
)
{
Widget
home
,
VoidCallback
retry
,{
double
paddingTop
}
)
{
return
StreamBuilder
(
return
StreamBuilder
(
stream:
stateLive
.
stream
,
stream:
stateLive
.
stream
,
initialData:
stateLive
.
data
??
LOADING
,
initialData:
stateLive
.
data
??
LOADING
,
...
@@ -499,9 +517,9 @@ Widget baseStateView(double width, double height, LiveData<int> stateLive,
...
@@ -499,9 +517,9 @@ Widget baseStateView(double width, double height, LiveData<int> stateLive,
if
(
data
.
data
==
LOADING
)
{
if
(
data
.
data
==
LOADING
)
{
return
loadingItem
();
return
loadingItem
();
}
else
if
(
data
.
data
==
FAIL
)
{
}
else
if
(
data
.
data
==
FAIL
)
{
return
errorItem
(
width
,
height
,
retry
);
return
errorItem
(
width
,
height
,
retry
,
paddingTop:
paddingTop
);
}
else
if
(
data
.
data
==
EMPTY
)
{
}
else
if
(
data
.
data
==
EMPTY
)
{
return
emptyItem
(
width
,
height
);
return
emptyItem
(
width
,
height
,
paddingTop:
paddingTop
);
}
}
return
home
;
return
home
;
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment