Skip to content

Commit 2bc2718

Browse files
committed
GFTabs completed
1 parent 6bb5121 commit 2bc2718

3 files changed

Lines changed: 92 additions & 65 deletions

File tree

example/lib/main.dart

Lines changed: 87 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,33 @@ class _MyHomePageState extends State<MyHomePage> {
7474
mainAxisAlignment: MainAxisAlignment.center,
7575
crossAxisAlignment: CrossAxisAlignment.center,
7676
children: <Widget>[
77+
// Container(
78+
// height: 300.0,
79+
// child: DefaultTabController(
80+
// length: 2,
81+
// child: Scaffold(
82+
// appBar: AppBar(
83+
// bottom: TabBar(
84+
// indicator: UnderlineTabIndicator(
85+
// borderSide: BorderSide(color: Color(0xDD613896), width: 2.0),
86+
// insets: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 4.0),
87+
// ),
88+
// tabs: [
89+
// Tab(icon: Icon(Icons.directions_car), text: "Non persistent",),
90+
// Tab(icon: Icon(Icons.directions_transit), text: "Persistent"),
91+
// ],
92+
// ),
93+
// title: Text('Persistent Tab Demo'),
94+
// ),
95+
// body: TabBarView(
96+
// children: [
97+
// Text("cdx"),
98+
// Text("cdv")
99+
// ],
100+
// ),
101+
// ),
102+
// ),
103+
// ),
77104

78105
GFSlider(
79106
// pagerSize: 12.0,
@@ -106,67 +133,67 @@ class _MyHomePageState extends State<MyHomePage> {
106133
},
107134
),
108135

109-
GFTabs(
110-
initialIndex: 0,
111-
length: 3,
112-
tabs: <Widget>[
113-
GFButton(
114-
onPressed: null,
115-
child: Text("share"),
116-
icon: Icon(Icons.share),
117-
),
118-
Tab(
119-
icon: Icon(Icons.error),
120-
child: Text(
121-
"Orders",
122-
),
123-
),
124-
Tab(
125-
child: Text(
126-
"Pastry",
127-
),
128-
),
129-
],
130-
tabBarViewChild: TabBarView(
131-
children: <Widget>[
132-
Container(
133-
color: Colors.red,
134-
child: Column(
135-
mainAxisAlignment: MainAxisAlignment.center,
136-
crossAxisAlignment: CrossAxisAlignment.center,
137-
children: <Widget>[
138-
Icon(Icons.directions_railway),
139-
GFButton(
140-
onPressed: null,
141-
child: Text("share"),
142-
icon: Icon(Icons.share),
143-
type: GFType.outline,
144-
shape: GFShape.pills,
136+
GFTabs(
137+
initialIndex: 0,
138+
length: 3,
139+
tabs: <Widget>[
140+
GFButton(
141+
onPressed: null,
142+
child: Text("share"),
143+
icon: Icon(Icons.share),
144+
),
145+
Tab(
146+
icon: Icon(Icons.error),
147+
child: Text(
148+
"Orders",
149+
),
150+
),
151+
Tab(
152+
child: Text(
153+
"Pastry",
154+
),
155+
),
156+
],
157+
tabBarView: TabBarView(
158+
children: <Widget>[
159+
Container(
160+
color: Colors.red,
161+
child: Column(
162+
mainAxisAlignment: MainAxisAlignment.center,
163+
crossAxisAlignment: CrossAxisAlignment.center,
164+
children: <Widget>[
165+
Icon(Icons.directions_railway),
166+
GFButton(
167+
onPressed: null,
168+
child: Text("share"),
169+
icon: Icon(Icons.share),
170+
type: GFType.transparent,
171+
shape: GFShape.pills,
172+
),
173+
],
174+
),
175+
),
176+
Icon(Icons.directions_car),
177+
Icon(Icons.directions_transit),
178+
],
179+
),
180+
// indicatorColor: Colors.teal,
181+
// indicatorSize: TabBarIndicatorSize.label,
182+
// labelColor: Colors.lightGreen,
183+
// unselectedLabelColor: Colors.black,
184+
// labelStyle: TextStyle(
185+
// fontWeight: FontWeight.w500,
186+
// fontSize: 13.0,
187+
// color: Colors.deepOrange,
188+
// fontFamily: 'OpenSansBold',
189+
// ),
190+
// unselectedLabelStyle: TextStyle(
191+
// fontWeight: FontWeight.w500,
192+
// fontSize: 13.0,
193+
// color: Colors.black,
194+
// fontFamily: 'OpenSansBold',
195+
// ),
145196
),
146-
],
147-
),
148-
),
149-
Icon(Icons.directions_car),
150-
Icon(Icons.directions_transit),
151-
],
152-
),
153-
labelColor: Colors.lightGreen,
154-
unselectedLabelColor: Colors.black,
155-
labelStyle: TextStyle(
156-
fontWeight: FontWeight.w500,
157-
fontSize: 13.0,
158-
color: Colors.deepOrange,
159-
fontFamily: 'OpenSansBold',
160-
),
161-
unselectedLabelStyle: TextStyle(
162-
fontWeight: FontWeight.w500,
163-
fontSize: 13.0,
164-
color: Colors.black,
165-
fontFamily: 'OpenSansBold',
166-
),
167-
),
168-
169-
170197

171198
// GFSlider(
172199
// autoPlay: true,

lib/components/card/gf_card.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ class GFCard extends StatelessWidget {
106106
titlePosition == GFPosition.start ? image != null ? image : Container(): title != null ? title : Container(),
107107
Padding(
108108
padding: padding,
109-
child: content,
109+
child: content != null ? content : Container(),
110110
),
111-
buttonBar,
111+
buttonBar == null ? Container() : buttonBar,
112112
],
113113
);
114114

lib/components/tabs/gf_tabs.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class GFTabs extends StatefulWidget {
2222
this.labelPadding,
2323
this.unselectedLabelColor,
2424
this.unselectedLabelStyle,
25-
this.tabBarViewChild,
25+
this.tabBarView,
2626
this.tabs,
2727
}):
2828
assert(length != null && length >= 0),
@@ -137,7 +137,7 @@ class GFTabs extends StatefulWidget {
137137
/// One widget per tab.
138138
/// Its length must match the length of the [GFTabs.tabs]
139139
/// list, as well as the [controller]'s [GFTabs.length].
140-
final TabBarView tabBarViewChild;
140+
final TabBarView tabBarView;
141141

142142
/// Typically a list of two or more [Tab] widgets.
143143
///
@@ -178,7 +178,7 @@ class _GFTabsState extends State<GFTabs> {
178178
),
179179
),
180180
Expanded(
181-
child: widget.tabBarViewChild
181+
child: widget.tabBarView
182182
),
183183
],
184184
),

0 commit comments

Comments
 (0)