Skip to content

Commit e47d116

Browse files
committed
gfintroscreen issues fixed
1 parent 09151ca commit e47d116

File tree

3 files changed

+128
-124
lines changed

3 files changed

+128
-124
lines changed

lib/components/accordian/gf_accordian.dart

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class GFAccordion extends StatefulWidget {
2525
this.contentBorderRadius = const BorderRadius.all(Radius.circular(0))})
2626
: super(key: key);
2727

28-
final Function(bool) onToggleCollapsed;
2928

3029
/// controls if the accordion should be collapsed or not making it possible to be controlled from outside
3130
final bool showAccordion;
@@ -45,10 +44,10 @@ class GFAccordion extends StatefulWidget {
4544
/// type of [Color] or [GFColors] which is used to change the background color of the [GFAccordion] title when it is expanded
4645
final Color expandedTitleBackgroundColor;
4746

48-
///collapsedIcon of type [Widget] which is used to show when the [GFAccordion] is collapsed
47+
/// collapsedIcon of type [Widget] which is used to show when the [GFAccordion] is collapsed
4948
final Widget collapsedIcon;
5049

51-
///expandedIcon of type[Widget] which is used when the [GFAccordion] is expanded
50+
/// expandedIcon of type[Widget] which is used when the [GFAccordion] is expanded
5251
final Widget expandedIcon;
5352

5453
/// text of type [String] is alternative to child. text will get priority over titleChild
@@ -57,30 +56,33 @@ class GFAccordion extends StatefulWidget {
5756
/// textStyle of type [textStyle] will be applicable to text only and not for the child
5857
final TextStyle textStyle;
5958

60-
///titlePadding of type [EdgeInsets] which is used to set the padding of the [GFAccordion] title
59+
/// titlePadding of type [EdgeInsets] which is used to set the padding of the [GFAccordion] title
6160
final EdgeInsets titlePadding;
6261

63-
///descriptionPadding of type [EdgeInsets] which is used to set the padding of the [GFAccordion] description
62+
/// descriptionPadding of type [EdgeInsets] which is used to set the padding of the [GFAccordion] description
6463
final EdgeInsets contentPadding;
6564

6665
/// type of [Color] or [GFColors] which is used to change the background color of the [GFAccordion] description
6766
final Color contentBackgroundColor;
6867

69-
///margin of type [EdgeInsets] which is used to set the margin of the [GFAccordion]
68+
/// margin of type [EdgeInsets] which is used to set the margin of the [GFAccordion]
7069
final EdgeInsets margin;
7170

72-
///titleBorderColor of type [Color] or [GFColors] which is used to change the border color of title
71+
/// titleBorderColor of type [Color] or [GFColors] which is used to change the border color of title
7372
final Border titleBorder;
7473

75-
///contentBorderColor of type [Color] or [GFColors] which is used to change the border color of content
74+
/// contentBorderColor of type [Color] or [GFColors] which is used to change the border color of content
7675
final Border contentBorder;
7776

78-
///titleBorderRadius of type [Radius] which is used to change the border radius of title
77+
/// titleBorderRadius of type [Radius] which is used to change the border radius of title
7978
final BorderRadius titleBorderRadius;
8079

81-
///contentBorderRadius of type [Radius] which is used to change the border radius of content
80+
/// contentBorderRadius of type [Radius] which is used to change the border radius of content
8281
final BorderRadius contentBorderRadius;
8382

83+
/// function called when the content body collapsed
84+
final Function(bool) onToggleCollapsed;
85+
8486
@override
8587
_GFAccordionState createState() => _GFAccordionState();
8688
}

lib/components/intro_screen/gf_intro_screen.dart

Lines changed: 20 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ class GFIntroScreen extends StatefulWidget {
66
const GFIntroScreen({
77
Key key,
88
@required this.pageController,
9+
@required this.currentIndex,
10+
@required this.pageCount,
911
@required this.slides,
1012
this.color,
1113
this.width,
@@ -14,8 +16,6 @@ class GFIntroScreen extends StatefulWidget {
1416
this.border,
1517
this.introScreenBottomNavigationBar,
1618
this.showIntroScreenBottomNavigationBar = true,
17-
this.currentIndex = 0,
18-
this.pageCount = 0,
1919
this.child,
2020
this.navigationBarColor = GFColors.SUCCESS,
2121
this.navigationBarHeight = 50,
@@ -68,23 +68,22 @@ class GFIntroScreen extends StatefulWidget {
6868
/// defines the list of slides
6969
final List<Widget> slides;
7070

71-
/// default controller for the [GFIntroScreen] component
71+
/// allows one to control [GFIntroScreen] slides
7272
final PageController pageController;
7373

74-
/// background color of the [GFIntroScreen] component
74+
/// defines background color of the [GFIntroScreen] slides
7575
final Color color;
7676

77-
/// defines [GFIntroScreen] height
77+
/// defines [GFIntroScreen] slides height
7878
final double height;
7979

80-
81-
/// defines [GFIntroScreen] width
80+
/// defines [GFIntroScreen] slides width
8281
final double width;
8382

84-
/// defines [GFIntroScreen] border radius to defines slide shape
83+
/// defines [GFIntroScreen] border radius to defines slides shape
8584
final BorderRadius borderRadius;
8685

87-
/// defines [GFIntroScreen] border
86+
/// defines [GFIntroScreen] slides border
8887
final Border border;
8988

9089
/// defines [GFIntroScreen]'s bottom navigation bar
@@ -99,7 +98,7 @@ class GFIntroScreen extends StatefulWidget {
9998
/// defines the length of [GFIntroScreen] slides, default value is 0
10099
final int pageCount;
101100

102-
/// defines [GFIntroScreenBottomNavigationBar], it takes any widget
101+
/// defines [GFIntroScreenBottomNavigationBar]'s child, it takes any widget
103102
final Widget child;
104103

105104
/// defines [GFIntroScreenBottomNavigationBar] height
@@ -132,28 +131,28 @@ class GFIntroScreen extends StatefulWidget {
132131
/// Called when the skip button is tapped
133132
final VoidCallback onSkipTap;
134133

135-
/// defines the backButton widget
134+
/// takes any Widget to define the backButton widget,
136135
final Widget backButton;
137136

138-
/// defines the forwardButton widget
137+
/// takes any Widget to define the forwardButton widget
139138
final Widget forwardButton;
140139

141-
/// defines the doneButton widget
140+
/// takes any Widget to define the doneButton widget
142141
final Widget doneButton;
143142

144-
/// defines the skipButton widget
143+
/// takes any Widget to define the skipButton widget
145144
final Widget skipButton;
146145

147-
/// defines the backButton text
146+
/// takes String to define backButton text
148147
final String backButtonText;
149148

150-
/// defines the forwardButton text
149+
/// takes String to define forwardButton text
151150
final String forwardButtonText;
152151

153-
/// defines the doneButton text
152+
/// takes String to define doneButton text
154153
final String doneButtonText;
155154

156-
/// defines the skipButton text
155+
/// takes String to define skipButton text
157156
final String skipButtonText;
158157

159158
/// defines the skipButton textStyle
@@ -209,28 +208,6 @@ class GFIntroScreen extends StatefulWidget {
209208
}
210209

211210
class _GFIntroScreenState extends State<GFIntroScreen> {
212-
PageController _pageController;
213-
int currentIndex;
214-
List<Widget> pages;
215-
216-
@override
217-
void initState() {
218-
_pageController = widget.pageController != null
219-
? widget.pageController
220-
: PageController(initialPage: 0);
221-
currentIndex = _pageController.initialPage;
222-
if (widget.pageController != null) {
223-
_pageController = widget.pageController;
224-
}
225-
_pageController.addListener(() {
226-
if (mounted) {
227-
setState(() {
228-
currentIndex = _pageController.page.round();
229-
});
230-
}
231-
});
232-
super.initState();
233-
}
234211

235212
@override
236213
Widget build(BuildContext context) => Center(
@@ -248,16 +225,16 @@ class _GFIntroScreenState extends State<GFIntroScreen> {
248225
children: <Widget>[
249226
Expanded(
250227
child: PageView(
251-
controller: _pageController,
228+
controller: widget.pageController,
252229
children: widget.slides,
253230
),
254231
),
255232
widget.showIntroScreenBottomNavigationBar
256233
? widget.introScreenBottomNavigationBar ??
257234
GFIntroScreenBottomNavigationBar(
258-
pageController: _pageController,
235+
pageController: widget.pageController,
259236
pageCount: widget.slides.length,
260-
currentIndex: currentIndex,
237+
currentIndex: widget.currentIndex,
261238
child: widget.child,
262239
navigationBarColor: widget.navigationBarColor,
263240
navigationBarHeight: widget.navigationBarHeight,

0 commit comments

Comments
 (0)