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
b49cdade
Commit
b49cdade
authored
Jul 05, 2020
by
朱翠翠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
逻辑添加
parent
c8d34ce1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
169 additions
and
173 deletions
+169
-173
CallBackCompareItem.dart
lib/ClueModel/page/PlansCompareFeed/CallBackCompareItem.dart
+3
-0
PlansCompareFeedItemView.dart
...Model/page/PlansCompareFeed/PlansCompareFeedItemView.dart
+74
-83
PlansCompareFeedPage.dart
...ClueModel/page/PlansCompareFeed/PlansCompareFeedPage.dart
+57
-33
ProjectDetailsItemView.dart
...ClueModel/page/ProjectDetails/ProjectDetailsItemView.dart
+30
-50
ProjectDetailsPage.dart
lib/ClueModel/page/ProjectDetails/ProjectDetailsPage.dart
+5
-7
No files found.
lib/ClueModel/page/PlansCompareFeed/CallBackCompareItem.dart
0 → 100644
View file @
b49cdade
class
CallBackCompareItem
{
checkedItem
(
int
id
)
{}
}
lib/ClueModel/page/PlansCompareFeed/PlansCompareFeedItemView.dart
View file @
b49cdade
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_common/commonModel/toast/NativeToast.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlansCompareFeed.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gm_flutter/commonModel/base/BaseState.dart'
;
class
PlansCompareFeedItemView
extends
StatelessWidget
{
import
'CallBackCompareItem.dart'
;
class
PlansCompareFeedItemView
extends
StatefulWidget
{
Plans
plan
;
CallBackCompareItem
compareItem
;
Set
<
int
>
_setCompare
;
PlansCompareFeedItemView
(
this
.
plan
);
PlansCompareFeedItemView
(
this
.
plan
,
this
.
compareItem
,
this
.
_setCompare
);
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
child:
getItem
());
State
<
StatefulWidget
>
createState
()
=>
_PlansCompareFeedItemViewState
();
}
class
_PlansCompareFeedItemViewState
extends
BaseState
<
PlansCompareFeedItemView
>
{
ImageIcon
_checked
=
ImageIcon
(
AssetImage
(
"assets/icon_compare_select.png"
));
ImageIcon
_unchecked
=
ImageIcon
(
AssetImage
(
"assets/icon_compare_unselect.png"
));
ImageIcon
_icon
=
ImageIcon
(
AssetImage
(
"assets/icon_compare_unselect.png"
));
@override
Widget
buildItem
(
BuildContext
context
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
),
child:
getItem
());
}
getItem
()
{
if
(
plan
.
planType
==
1
)
{
if
(
widget
.
plan
.
planType
==
2
)
{
return
getFirstLevelItem
();
}
else
{
return
getSecondLevelItem
();
...
...
@@ -25,19 +45,19 @@ class PlansCompareFeedItemView extends StatelessWidget {
width:
double
.
maxFinite
,
height:
90
,
alignment:
Alignment
.
centerLeft
,
padding:
EdgeInsets
.
only
(
left:
15
,
right:
15
,
top:
20
,
bottom:
20
),
padding:
EdgeInsets
.
only
(
top:
20
,
bottom:
20
),
child:
Row
(
children:
<
Widget
>[
IconButton
(
icon:
ImageIcon
(
AssetImage
(
"assets/icon_compare_select.png"
))
,
onPressed:
()
=>
print
(
'FlatButton pressed'
),
icon:
_icon
,
onPressed:
()
=>
onClickCheckBox
(
_icon
),
),
Container
(
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
),
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
2.0
),
child:
Image
.
network
(
plan
.
projectImage
,
widget
.
plan
.
projectImage
,
width:
50
,
height:
50
,
fit:
BoxFit
.
fill
,
...
...
@@ -53,42 +73,20 @@ class PlansCompareFeedItemView extends StatelessWidget {
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
,
),
baseText
(
widget
.
plan
.
name
,
14
,
Color
(
0xFF282828
),
bold:
true
),
baseText
(
" 好评率 "
,
11
,
Color
(
0xFF282828
)),
baseText
(
widget
.
plan
.
positiveRate
,
14
,
Color
(
0xFFFF5963
),
bold:
true
),
],
),
),
Row
(
children:
<
Widget
>[
Text
(
'¥
${plan.minPrice}
-
${plan.maxPrice}
'
,
style:
TextStyle
(
fontSize:
13
,
color:
Color
(
0xFFFF5963
)),
),
Text
(
"销量
${plan.salesCount}
"
,
style:
TextStyle
(
fontSize:
11
,
color:
Color
(
0xFF282828
)),
maxLines:
1
,
)
baseText
(
'¥
${widget.plan.minPrice}
-
${widget.plan.maxPrice}
'
,
13
,
Color
(
0xFFFF5963
)),
baseText
(
" 销量
${widget.plan.salesCount}
"
,
11
,
Color
(
0xFF282828
))
],
)
],
...
...
@@ -101,62 +99,55 @@ class PlansCompareFeedItemView extends StatelessWidget {
getSecondLevelItem
()
{
return
Container
(
width:
double
.
maxFinite
,
height:
77
,
alignment:
Alignment
.
centerLeft
,
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
),
child:
Row
(
children:
<
Widget
>[
Container
(
margin:
EdgeInsets
.
only
(
right:
15.0
),
alignment:
Alignment
.
centerLeft
,
width:
17
,
height:
17
,
child:
IconButton
(
icon:
ImageIcon
(
AssetImage
(
"assets/icon_compare_select.png"
))
,
onPressed:
()
=>
print
(
'FlatButton pressed'
),
icon:
_icon
,
onPressed:
()
=>
onClickCheckBox
(
_icon
),
),
),
Container
(
margin:
EdgeInsets
.
only
(
left:
15.0
),
height:
77
,
alignment:
Alignment
.
centerLeft
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
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}
'
,
style:
TextStyle
(
fontSize:
13
,
color:
Color
(
0xFFFF5963
)),
),
Container
(
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Container
(
margin:
EdgeInsets
.
only
(
top:
13.0
,
bottom:
12
),
child:
baseText
(
widget
.
plan
.
name
,
14
,
Color
(
0xFF282828
),
bold:
true
),
),
Row
(
children:
<
Widget
>[
baseText
(
'¥
${widget.plan.minPrice}
-
${widget.plan.maxPrice}
'
,
13
,
Color
(
0xFFFF5963
)),
Container
(
width:
160
,
alignment:
Alignment
.
centerRight
,
child:
Text
(
"指导价:¥
${plan.guidePrice}
"
,
style:
TextStyle
(
fontSize:
11
,
color:
Color
(
0xFF282828
)),
maxLines:
1
,
),
),
],
)
],
),
child:
baseText
(
"指导价:¥
${widget.plan.guidePrice}
"
,
11
,
Color
(
0xFF282828
))),
],
),
],
)
],
),
);
}
onClickCheckBox
(
ImageIcon
icon
)
{
if
(
icon
==
_checked
)
{
_icon
=
_unchecked
;
}
else
{
if
(
widget
.
_setCompare
.
length
==
2
)
{
NativeToast
.
showNativeToast
(
"不许再选了两个够了!"
);
return
;
}
_icon
=
_checked
;
}
setState
(()
{
widget
.
compareItem
.
checkedItem
(
widget
.
plan
.
planId
);
});
}
}
lib/ClueModel/page/PlansCompareFeed/PlansCompareFeedPage.dart
View file @
b49cdade
...
...
@@ -10,33 +10,37 @@ import 'package:gm_flutter/ClueModel/server/entity/PlansCompareFeed.dart';
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gm_flutter/commonModel/base/BaseState.dart'
;
import
'CallBackCompareItem.dart'
;
import
'PlansCompareFeedItemView.dart'
;
class
PlansCompareFeedPage
extends
StatefulWidget
{
@override
State
<
StatefulWidget
>
createState
()
=>
PlansCompareFeedState
();
State
<
StatefulWidget
>
createState
()
=>
_
PlansCompareFeedState
();
}
class
PlansCompareFeedState
extends
BaseState
<
PlansCompareFeedPage
>
{
PlansCompareFeedModel
_model
=
new
PlansCompareFeedModel
();
class
_PlansCompareFeedState
extends
BaseState
<
PlansCompareFeedPage
>
implements
CallBackCompareItem
{
PlansCompareFeedModel
_model
;
Color
_compareColor
;
Set
<
int
>
_setCompare
;
@override
void
initState
()
{
super
.
initState
();
_model
=
new
PlansCompareFeedModel
();
_model
.
init
();
_compareColor
=
Color
(
0xFFCCCCCC
);
_setCompare
=
Set
();
}
@override
void
dispose
()
{
_model
.
dispose
();
super
.
dispose
();
_model
.
dispose
();
}
@override
Widget
buildItem
(
BuildContext
context
)
{}
@override
Widget
build
(
BuildContext
context
)
{
Widget
buildItem
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
baseAppBar
(
title:
"方案对比"
,
...
...
@@ -50,31 +54,6 @@ class PlansCompareFeedState extends BaseState<PlansCompareFeedPage> {
);
}
getList
(
List
<
Plans
>
plans
)
{
return
Stack
(
alignment:
Alignment
.
bottomCenter
,
//指定未定位或部分定位widget的对齐方式
children:
<
Widget
>[
ListView
.
builder
(
itemCount:
plans
.
length
,
itemBuilder:
(
BuildContext
context
,
int
position
)
{
return
PlansCompareFeedItemView
(
plans
[
position
]);
}),
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
onTap:
()
{},
child:
Container
(
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
,
top:
7.5
,
bottom:
7.5
),
width:
double
.
maxFinite
,
height:
40
,
decoration:
BoxDecoration
(
color:
Color
(
0xff51CDC7
),
borderRadius:
BorderRadius
.
circular
(
20
)),
alignment:
Alignment
.
center
,
child:
baseText
(
"对比"
,
14
,
Colors
.
white
,
bold:
true
),
))
]);
}
getBody
()
{
return
StreamBuilder
(
stream:
_model
.
liveData
.
stream
,
...
...
@@ -96,4 +75,49 @@ class PlansCompareFeedState extends BaseState<PlansCompareFeedPage> {
},
);
}
getList
(
List
<
Plans
>
plans
)
{
return
Stack
(
alignment:
Alignment
.
bottomCenter
,
children:
<
Widget
>[
ListView
.
builder
(
itemCount:
plans
.
length
,
itemBuilder:
(
BuildContext
context
,
int
position
)
{
return
PlansCompareFeedItemView
(
plans
[
position
],
this
,
_setCompare
);
}),
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
onTap:
()
=>
onClickCompare
(),
child:
Container
(
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
,
top:
7.5
,
bottom:
7.5
),
width:
double
.
maxFinite
,
height:
40
,
decoration:
BoxDecoration
(
color:
_compareColor
,
borderRadius:
BorderRadius
.
circular
(
20
)),
alignment:
Alignment
.
center
,
child:
baseText
(
"对比"
,
14
,
Colors
.
white
,
bold:
true
),
))
]);
}
onClickCompare
()
{
if
(
_compareColor
==
Color
(
0xFFCCCCCC
))
return
;
setState
(()
{
print
(
"onClickCompare=====_compareColor
$_compareColor
"
);
});
}
@override
checkedItem
(
int
id
)
{
if
(
_setCompare
.
contains
(
id
))
{
_setCompare
.
remove
(
id
);
}
else
{
_setCompare
.
add
(
id
);
}
setState
(()
{
if
(
_setCompare
.
length
==
2
)
{
_compareColor
=
Color
(
0xff51CDC7
);
}
else
{
_compareColor
=
Color
(
0xFFCCCCCC
);
}
});
}
}
lib/ClueModel/page/ProjectDetails/ProjectDetailsItemView.dart
View file @
b49cdade
...
...
@@ -6,52 +6,48 @@
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/ProjectDetailsItem.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
class
ProjectDetailsItemView
extends
StatelessWidget
{
Groups
listData
;
List
<
Widget
>
listAttrs
=
[];
ProjectDetailsItemView
(
this
.
listData
);
ProjectDetailsItemView
(
this
.
listData
)
{
init
();
}
@override
Widget
build
(
BuildContext
context
)
{
List
<
Widget
>
tiles
=
[];
init
()
{
for
(
var
item
in
listData
.
attrs
)
{
tiles
.
add
(
get
Item
(
item
));
listAttrs
.
add
(
getAttr
Item
(
item
));
}
var
column
=
Column
(
}
@override
Widget
build
(
BuildContext
context
)
{
return
Column
(
children:
<
Widget
>[
Container
(
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
,
),
),
),
padding:
EdgeInsets
.
only
(
left:
15.0
),
margin:
EdgeInsets
.
only
(
bottom:
16.0
),
alignment:
Alignment
.
centerLeft
,
height:
55
,
decoration:
BoxDecoration
(
image:
DecorationImage
(
image:
AssetImage
(
"assets/bg_project_detail_item.png"
),
fit:
BoxFit
.
cover
)),
child:
baseText
(
listData
.
name
,
15
,
Colors
.
black
,
bold:
true
)),
Column
(
children:
tiles
,
children:
listAttrs
,
),
SizedBox
(
height:
5
,
)
],
);
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
5
),
child:
column
,
);
}
getItem
(
Attrs
attrs
)
{
var
row
=
Container
(
get
Attr
Item
(
Attrs
attrs
)
{
return
Container
(
width:
double
.
maxFinite
,
margin:
EdgeInsets
.
only
(
bottom:
25
,
left:
15
,
right:
15
),
child:
Row
(
...
...
@@ -60,29 +56,13 @@ class ProjectDetailsItemView extends StatelessWidget {
margin:
EdgeInsets
.
only
(
right:
25.0
),
alignment:
Alignment
.
centerLeft
,
width:
78
,
child:
Text
(
attrs
.
attrName
,
style:
TextStyle
(
color:
Color
(
0xFF999999
),
fontSize:
13.0
,
),
),
child:
baseText
(
attrs
.
attrName
,
13
,
Color
(
0xFF999999
)),
),
Container
(
alignment:
Alignment
.
centerLeft
,
child:
Text
(
attrs
.
attrValue
,
style:
TextStyle
(
color:
Color
(
0xFF282828
),
fontSize:
14.0
,
),
),
),
alignment:
Alignment
.
centerLeft
,
child:
baseText
(
attrs
.
attrValue
,
14
,
Color
(
0xFF282828
))),
],
),
);
return
Container
(
child:
row
,
);
}
}
lib/ClueModel/page/ProjectDetails/ProjectDetailsPage.dart
View file @
b49cdade
...
...
@@ -14,15 +14,16 @@ import '../../server/entity/ProjectDetailsItem.dart';
class
ProjectDetailsPage
extends
StatefulWidget
{
@override
State
<
StatefulWidget
>
createState
()
=>
ProjectDetailsState
();
State
<
StatefulWidget
>
createState
()
=>
_
ProjectDetailsState
();
}
class
ProjectDetailsState
extends
BaseState
<
ProjectDetailsPage
>
{
ProjectDetailsModel
_model
=
new
ProjectDetailsModel
()
;
class
_
ProjectDetailsState
extends
BaseState
<
ProjectDetailsPage
>
{
ProjectDetailsModel
_model
;
@override
void
initState
()
{
super
.
initState
();
_model
=
new
ProjectDetailsModel
();
_model
.
init
();
}
...
...
@@ -33,10 +34,7 @@ class ProjectDetailsState extends BaseState<ProjectDetailsPage> {
}
@override
Widget
buildItem
(
BuildContext
context
)
{}
@override
Widget
build
(
BuildContext
context
)
{
Widget
buildItem
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
baseAppBar
(
title:
"项目说明"
,
...
...
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