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
f6a8e0b6
Commit
f6a8e0b6
authored
Jul 02, 2020
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
d1df55f1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
26 deletions
+26
-26
LevelTwoPage.dart
lib/ClueModel/page/levelTwo/LevelTwoPage.dart
+3
-3
TopModel.dart
lib/ClueModel/page/top/TopModel.dart
+1
-5
TopPage.dart
lib/ClueModel/page/top/TopPage.dart
+9
-10
BaseComponent.dart
lib/commonModel/base/BaseComponent.dart
+13
-8
No files found.
lib/ClueModel/page/levelTwo/LevelTwoPage.dart
View file @
f6a8e0b6
...
...
@@ -491,7 +491,7 @@ Widget askWidget() {
}
class
StickyTabBarDelegate
extends
SliverPersistentHeaderDelegate
{
final
TabBar
child
;
final
Widget
child
;
StickyTabBarDelegate
({
@required
this
.
child
});
...
...
@@ -502,10 +502,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
)
{
...
...
lib/ClueModel/page/top/TopModel.dart
View file @
f6a8e0b6
...
...
@@ -8,18 +8,14 @@ import 'package:flutter_common/commonModel/live/LiveData.dart';
class
TopModel
extends
BaseModel
{
int
tabIndex
=
0
;
List
<
String
>
tabs
=
[
"全部"
,
"眼部"
,
"自体脂肪"
,
"轮廓骨骼"
];
LiveData
<
int
>
tabIndexLive
=
LiveData
();
@override
void
dispose
()
{
tabIndexLive
.
dispost
();
}
void
dispose
()
{}
void
selectTab
(
int
index
)
{
if
(
tabIndex
==
index
)
{
return
;
}
tabIndex
=
index
;
tabIndexLive
.
notifyView
(
index
);
}
}
lib/ClueModel/page/top/TopPage.dart
View file @
f6a8e0b6
...
...
@@ -56,15 +56,20 @@ class TopPageState extends BaseState<TopPage> with TickerProviderStateMixin {
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
>[
...
...
@@ -86,16 +91,10 @@ class TopPageState extends BaseState<TopPage> with TickerProviderStateMixin {
List
<
Widget
>
getTabs
()
{
List
<
Widget
>
list
=
[];
for
(
int
i
=
0
;
i
<
_model
.
tabs
.
length
;
i
++)
{
list
.
add
(
Container
(
height:
40
,
width:
50
,
color:
Colors
.
red
,
));
// list.add(baseTabBarItem(_model.tabs[i],
// leftPadding: i == 0 ? 24 : 28,
// color: i == _model.tabIndex ? Color(0xff282828) : Color(0xffB5B5B5)));
list
.
add
(
baseTabBarItem
(
_model
.
tabs
[
i
],
leftPadding:
i
==
0
?
24
:
28
,
rightPadding:
i
==
_model
.
tabs
.
length
-
1
?
24
:
28
));
}
return
list
;
}
...
...
lib/commonModel/base/BaseComponent.dart
View file @
f6a8e0b6
...
...
@@ -400,12 +400,16 @@ Widget emptyItem(double width, double height, {String detail}) {
Widget
baseTabBar
(
TabController
controller
,
List
<
Widget
>
list
,
Function
(
int
index
)
clickItem
,
{
BaseIndicator
baseIndicator
})
{
TabBar
(
{
BaseIndicator
baseIndicator
,
double
fontSize
,
Color
color
,
bool
scroll
})
{
return
TabBar
(
onTap:
clickItem
,
controller:
controller
,
indicatorSize:
TabBarIndicatorSize
.
tab
,
isScrollable:
true
,
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
,
...
...
@@ -416,15 +420,16 @@ Widget baseTabBarItem(
String
text
,
{
double
leftPadding
,
double
rightPadding
,
double
fontSize
,
Color
color
,
})
{
double
width
=
leftPadding
??
28
+
text
.
length
*
40.0
+
rightPadding
??
28
;
print
(
"WIDTH
${width}
"
);
leftPadding
=
leftPadding
??
28.0
;
rightPadding
=
rightPadding
??
28.0
;
double
width
=
leftPadding
+
text
.
length
*
16.0
+
rightPadding
;
return
Container
(
height:
40
,
width:
width
,
alignment:
Alignment
.
center
,
child:
baseText
(
text
,
fontSize
??
16
,
color
??
Color
(
0xffB5B5B5
)),
child:
Tab
(
text:
text
,
),
);
}
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