Skip to content

Commit cc34387

Browse files
author
srinivas
committed
working on Intro Screen bubble type
1 parent 53987f1 commit cc34387

File tree

3 files changed

+51
-26
lines changed

3 files changed

+51
-26
lines changed

lib/components/intro_screen/custom_clipper.dart

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,25 @@ class MyCustomClipper extends CustomClipper<Rect> {
99
Rect getClip(Size size) {
1010
final Rect rect = alignment == Alignment.topLeft
1111
? Rect.fromLTRB(-size.width, -size.height, size.width, size.height)
12-
: alignment == Alignment.topRight
13-
? Rect.fromLTRB(-size.height, -size.width, size.width, size.height)
14-
: alignment == Alignment.topCenter
15-
? Rect.fromLTRB(-size.width, -size.height, -size.width, 0)
12+
: alignment == Alignment.topCenter
13+
? Rect.fromLTRB(0, -size.height, size.width, size.height)
14+
: alignment == Alignment.topRight
15+
? Rect.fromLTRB(
16+
-size.height, 1, size.width, size.height)
1617
: alignment == Alignment.bottomLeft
17-
? Rect.fromLTRB(0, -size.height, size.width, size.height)
18+
? Rect.fromLTRB(
19+
-size.width, -size.height, size.width, size.height)
1820
: alignment == Alignment.bottomCenter
1921
? Rect.fromLTRB(
20-
0, -size.height, size.width, size.height)
21-
: Rect.fromLTRB(
22-
0, -size.height, size.width, size.height);
22+
0, 0, size.width, size.height)
23+
: alignment == Alignment.bottomRight
24+
? Rect.fromLTRB(
25+
0, -size.height, size.width, size.height)
26+
: Rect.fromLTRB(
27+
0, -size.height, size.width, size.height);
2328
return rect;
2429
}
2530

2631
@override
27-
bool shouldReclip(CustomClipper oldClipper) => false;
32+
bool shouldReclip(CustomClipper oldClipper) => true;
2833
}

lib/components/intro_screen/gf_intro_bubble_slide.dart

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@ import 'custom_clipper.dart';
44

55
class GFIntroBubbleSlide extends StatelessWidget {
66
const GFIntroBubbleSlide(
7-
{Key key, this.onNext, this.onNextTitle = 'Ok next', this.child, this.alignment})
7+
{Key key,
8+
this.onNext,
9+
this.onNextTitle = 'Ok next',
10+
this.child,
11+
this.alignment,
12+
this.color = Colors.blue})
813
: super(key: key);
914

1015
final Function onNext;
1116
final String onNextTitle;
1217
final Widget child;
18+
final Color color;
1319
final Alignment alignment;
1420

1521
@override
@@ -20,10 +26,10 @@ class GFIntroBubbleSlide extends StatelessWidget {
2026
child: ClipOval(
2127
clipper: MyCustomClipper(alignment: alignment),
2228
child: Container(
29+
width: MediaQuery.of(context).size.width / 2,
2330
height: MediaQuery.of(context).size.height / 3,
24-
padding: const EdgeInsets.only(
25-
left: 24, right: 24, top: 24, bottom: 64),
26-
color: Colors.yellow,
31+
padding: const EdgeInsets.only(right: 24, top: 24, bottom: 64),
32+
color: color.withOpacity(0.5),
2733
child: child ??
2834
RawMaterialButton(
2935
child: Text(onNextTitle), onPressed: onNext),

lib/components/intro_screen/gf_intro_screen.dart

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,28 +140,42 @@ class _GFIntroScreenState extends State<GFIntroScreen> {
140140
return list;
141141
}
142142

143-
Widget buildBubbleType() => SafeArea(
144-
child: Container(
145-
height: MediaQuery.of(context).size.height,
146-
width: MediaQuery.of(context).size.width,
147-
child: PageView(
148-
physics: const ScrollPhysics(),
149-
children: bubbleSlides(),
150-
controller: _pageController,
151-
),
152-
),
153-
);
143+
Widget buildBubbleType() => Container(
144+
height: MediaQuery.of(context).size.height,
145+
width: MediaQuery.of(context).size.width,
146+
child: PageView(
147+
physics: const ScrollPhysics(),
148+
children: bubbleSlides(),
149+
controller: _pageController,
150+
),
151+
);
154152

155153
List<Widget> bubbleSlides() {
156154
final List<Widget> list = [];
157155
list.add(GFIntroBubbleSlide(
158-
onNext: () => nextSlider,
156+
onNext: nextSlider,
159157
alignment: Alignment.topLeft,
160158
));
161159
list.add(GFIntroBubbleSlide(
162-
onNext: () => nextSlider,
160+
onNext: nextSlider,
161+
alignment: Alignment.topCenter,
162+
));
163+
list.add(GFIntroBubbleSlide(
164+
onNext: nextSlider,
163165
alignment: Alignment.topRight,
164166
));
167+
list.add(GFIntroBubbleSlide(
168+
onNext: nextSlider,
169+
alignment: Alignment.bottomLeft,
170+
));
171+
list.add(GFIntroBubbleSlide(
172+
onNext: nextSlider,
173+
alignment: Alignment.bottomCenter,
174+
));
175+
list.add(GFIntroBubbleSlide(
176+
onNext: nextSlider,
177+
alignment: Alignment.bottomRight,
178+
));
165179
return list;
166180
}
167181

0 commit comments

Comments
 (0)