Skip to content

Commit 5094cb2

Browse files
author
srinivas
committed
added three types full,half,rounded in GFIntroScreen
1 parent 34a9182 commit 5094cb2

File tree

2 files changed

+52
-20
lines changed

2 files changed

+52
-20
lines changed

lib/components/intro_screen/gf_intro_screen.dart

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
import 'package:flutter/material.dart';
22
import 'package:getwidget/components/intro_screen/gf__intro_bottom_navigation.dart';
33
import 'package:getwidget/components/intro_screen/gf_intro_slide.dart';
4+
import 'package:getwidget/getwidget.dart';
5+
import 'package:getwidget/types/gf_intro_type.dart';
46

57
class GFIntroScreen extends StatefulWidget {
68
const GFIntroScreen(
7-
{Key key, this.slides, this.pageController, this.gfIntroBottomNavigation})
9+
{Key key,
10+
this.slides,
11+
this.pageController,
12+
this.gfIntroBottomNavigation,
13+
this.type})
814
: super(key: key);
915

1016
final List<Widget> slides;
17+
final GFIntroType type;
1118
final PageController pageController;
1219
final GFIntroBottomNavigation gfIntroBottomNavigation;
1320

@@ -35,25 +42,49 @@ class _GFIntroScreenState extends State<GFIntroScreen> {
3542
}
3643

3744
@override
38-
Widget build(BuildContext context) => Container(
39-
child: Column(
40-
children: <Widget>[
41-
Expanded(
42-
child: PageView(
43-
controller: _pageController,
44-
children: widget.slides ?? slides(),
45-
)),
46-
widget.gfIntroBottomNavigation ??
47-
GFIntroBottomNavigation(
48-
onNext: () {
49-
_pageController.nextPage(
50-
duration: const Duration(milliseconds: 500),
51-
curve: Curves.linear);
52-
},
53-
pagesCount: widget.slides ?? slides().length,
54-
pageNumber: page,
55-
)
56-
],
45+
Widget build(BuildContext context) => Center(
46+
child: Container(
47+
width: widget.type == GFIntroType.fullWidth
48+
? MediaQuery.of(context).size.width
49+
: MediaQuery.of(context).size.width * 0.885,
50+
height: widget.type != GFIntroType.fullWidth
51+
? MediaQuery.of(context).size.height / 2
52+
: MediaQuery.of(context).size.height,
53+
margin: widget.type != GFIntroType.fullWidth
54+
? const EdgeInsets.only(left: 20, right: 20)
55+
: const EdgeInsets.only(left: 0, right: 0),
56+
padding: widget.type == GFIntroType.fullWidth
57+
? const EdgeInsets.all(0)
58+
: const EdgeInsets.all(0),
59+
decoration: BoxDecoration(
60+
color: Colors.transparent,
61+
borderRadius: widget.type == GFIntroType.fullWidth
62+
? BorderRadius.circular(0)
63+
: widget.type == GFIntroType.rounded
64+
? BorderRadius.circular(20)
65+
: BorderRadius.zero,
66+
),
67+
child: Column(
68+
mainAxisAlignment: MainAxisAlignment.center,
69+
crossAxisAlignment: CrossAxisAlignment.center,
70+
children: <Widget>[
71+
Expanded(
72+
child: PageView(
73+
controller: _pageController,
74+
children: widget.slides ?? slides(),
75+
)),
76+
widget.gfIntroBottomNavigation ??
77+
GFIntroBottomNavigation(
78+
onNext: () {
79+
_pageController.nextPage(
80+
duration: const Duration(milliseconds: 500),
81+
curve: Curves.linear);
82+
},
83+
pagesCount: widget.slides ?? slides().length,
84+
pageNumber: page,
85+
)
86+
],
87+
),
5788
),
5889
);
5990

lib/types/gf_intro_type.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
enum GFIntroType { fullWidth, half, rounded }

0 commit comments

Comments
 (0)