11import 'package:flutter/material.dart' ;
22import 'package:getwidget/components/intro_screen/gf__intro_bottom_navigation.dart' ;
3- import 'package:getwidget/components/intro_screen/gf_intro_bubble_slide.dart' ;
43import 'package:getwidget/components/intro_screen/gf_intro_slide.dart' ;
54import 'package:getwidget/types/gf_intro_type.dart' ;
65
@@ -15,7 +14,6 @@ class GFIntroScreen extends StatefulWidget {
1514 : super (key: key);
1615
1716 /// if the type as [GFIntroType.fullWidth] ,[GFIntroType.half] ,[GFIntroType.rounded] use [GFIntroSlide] 's or customWidgets
18- /// if the type as [GFIntroType.bubble] use [GFIntroBubbleSlide] 's or customWidgets
1917 final List <Widget > slides;
2018
2119 /// type of [GFIntroType] which takes the type ie, fullWidth, half,rounded and bubble for the [GFIntroScreen]
@@ -55,143 +53,56 @@ class _GFIntroScreenState extends State<GFIntroScreen> {
5553 }
5654
5755 @override
58- Widget build (BuildContext context) => widget.type == GFIntroType .bubble
59- ? buildBubbleType ()
60- : Center (
61- child: Container (
62- width: widget.type == GFIntroType .fullWidth
63- ? MediaQuery .of (context).size.width
64- : MediaQuery .of (context).size.width * 0.885 ,
65- height: widget.type != GFIntroType .fullWidth
66- ? MediaQuery .of (context).size.height / 2
67- : MediaQuery .of (context).size.height,
68- margin: widget.type != GFIntroType .fullWidth
69- ? const EdgeInsets .only (left: 20 , right: 20 )
70- : const EdgeInsets .only (left: 0 , right: 0 ),
71- padding: widget.type == GFIntroType .fullWidth
72- ? const EdgeInsets .all (0 )
73- : const EdgeInsets .all (0 ),
74- decoration: BoxDecoration (
75- color: widget.color,
76- borderRadius: widget.type == GFIntroType .fullWidth
77- ? BorderRadius .circular (0 )
78- : widget.type == GFIntroType .rounded
79- ? BorderRadius .circular (24 )
80- : BorderRadius .zero,
81- ),
82- child: Column (
83- mainAxisAlignment: MainAxisAlignment .center,
84- crossAxisAlignment: CrossAxisAlignment .center,
85- children: < Widget > [
86- Expanded (
87- child: ClipRRect (
88- borderRadius: widget.type == GFIntroType .rounded
89- ? const BorderRadius .only (
90- topLeft: Radius .circular (24 ),
91- topRight: Radius .circular (24 ))
92- : BorderRadius .zero,
93- child: PageView (
94- controller: _pageController,
95- children: widget.slides ?? slides (),
96- ),
97- )),
98- widget.gfIntroBottomNavigation ??
99- GFIntroBottomNavigation (
100- onNext: () {
101- _pageController.nextPage (
102- duration: const Duration (milliseconds: 500 ),
103- curve: Curves .linear);
104- },
105- pagesCount: widget.slides.length ?? slides ().length,
106- pageNumber: page,
107- )
108- ],
109- ),
56+ Widget build (BuildContext context) => Center (
57+ child: Container (
58+ width: widget.type == GFIntroType .fullWidth
59+ ? MediaQuery .of (context).size.width
60+ : MediaQuery .of (context).size.width * 0.885 ,
61+ height: widget.type != GFIntroType .fullWidth
62+ ? MediaQuery .of (context).size.height / 2
63+ : MediaQuery .of (context).size.height,
64+ margin: widget.type != GFIntroType .fullWidth
65+ ? const EdgeInsets .only (left: 20 , right: 20 )
66+ : const EdgeInsets .only (left: 0 , right: 0 ),
67+ padding: widget.type == GFIntroType .fullWidth
68+ ? const EdgeInsets .all (0 )
69+ : const EdgeInsets .all (0 ),
70+ decoration: BoxDecoration (
71+ color: widget.color,
72+ borderRadius: widget.type == GFIntroType .fullWidth
73+ ? BorderRadius .circular (0 )
74+ : widget.type == GFIntroType .rounded
75+ ? BorderRadius .circular (24 )
76+ : BorderRadius .zero,
77+ ),
78+ child: Column (
79+ mainAxisAlignment: MainAxisAlignment .center,
80+ crossAxisAlignment: CrossAxisAlignment .center,
81+ children: < Widget > [
82+ Expanded (
83+ child: ClipRRect (
84+ borderRadius: widget.type == GFIntroType .rounded
85+ ? const BorderRadius .only (
86+ topLeft: Radius .circular (24 ),
87+ topRight: Radius .circular (24 ))
88+ : BorderRadius .zero,
89+ child: PageView (
90+ controller: _pageController,
91+ children: widget.slides,
92+ ),
93+ )),
94+ widget.gfIntroBottomNavigation ??
95+ GFIntroBottomNavigation (
96+ onNext: () {
97+ _pageController.nextPage (
98+ duration: const Duration (milliseconds: 500 ),
99+ curve: Curves .linear);
100+ },
101+ pagesCount: widget.slides.length,
102+ pageNumber: page,
103+ )
104+ ],
110105 ),
111- );
112-
113- List <Widget > slides () {
114- final List <Widget > list = [];
115- list.add (const GFIntroSlide (
116- backgroundColor: Colors .white,
117- title: 'First' ,
118- imageHeight: 200 ,
119- imageWidth: 200 ,
120- image: NetworkImage ('https://www.gstatic.com/webp/gallery/3.jpg' ),
121- ));
122- list.add (const GFIntroSlide (
123- backgroundColor: Colors .yellow,
124- title: 'Second' ,
125- imageHeight: 200 ,
126- imageWidth: 200 ,
127- image: NetworkImage ('https://www.gstatic.com/webp/gallery/1.jpg' ),
128- ));
129- list.add (const GFIntroSlide (
130- backgroundColor: Colors .brown,
131- title: 'Third' ,
132- imageHeight: 200 ,
133- imageWidth: 200 ,
134- image: NetworkImage ('https://www.gstatic.com/webp/gallery/2.jpg' ),
135- ));
136- list.add (const GFIntroSlide (
137- backgroundColor: Colors .purple,
138- title: 'Fourth' ,
139- imageHeight: 200 ,
140- imageWidth: 200 ,
141- image: NetworkImage ('https://www.gstatic.com/webp/gallery/3.jpg' ),
142- ));
143- list.add (const GFIntroSlide (
144- backgroundColor: Colors .orange,
145- title: 'Fifth' ,
146- imageHeight: 200 ,
147- imageWidth: 200 ,
148- image: NetworkImage ('https://www.gstatic.com/webp/gallery/4.jpg' ),
149- ));
150- return list;
151- }
152-
153- Widget buildBubbleType () => Container (
154- height: MediaQuery .of (context).size.height,
155- width: MediaQuery .of (context).size.width,
156- child: PageView (
157- physics: const ScrollPhysics (),
158- children: bubbleSlides (),
159- controller: _pageController,
160106 ),
161107 );
162-
163- List <Widget > bubbleSlides () {
164- final List <Widget > list = [];
165- list.add (GFIntroBubbleSlide (
166- onNext: nextSlider,
167- alignment: Alignment .topLeft,
168- ));
169- list.add (GFIntroBubbleSlide (
170- onNext: nextSlider,
171- alignment: Alignment .topCenter,
172- ));
173- list.add (GFIntroBubbleSlide (
174- onNext: nextSlider,
175- alignment: Alignment .topRight,
176- ));
177- list.add (GFIntroBubbleSlide (
178- onNext: nextSlider,
179- alignment: Alignment .bottomLeft,
180- ));
181- list.add (GFIntroBubbleSlide (
182- onNext: nextSlider,
183- alignment: Alignment .bottomCenter,
184- ));
185- list.add (GFIntroBubbleSlide (
186- onNext: nextSlider,
187- alignment: Alignment .bottomRight,
188- ));
189- return list;
190- }
191-
192- // ignore: type_annotate_public_apis, always_declare_return_types
193- nextSlider () {
194- _pageController.nextPage (
195- duration: const Duration (milliseconds: 300 ), curve: Curves .linear);
196- }
197108}
0 commit comments