|
1 | 1 | import 'package:flutter/material.dart'; |
2 | 2 | import 'package:getwidget/components/intro_screen/gf__intro_bottom_navigation.dart'; |
3 | 3 | 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'; |
4 | 6 |
|
5 | 7 | class GFIntroScreen extends StatefulWidget { |
6 | 8 | 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}) |
8 | 14 | : super(key: key); |
9 | 15 |
|
10 | 16 | final List<Widget> slides; |
| 17 | + final GFIntroType type; |
11 | 18 | final PageController pageController; |
12 | 19 | final GFIntroBottomNavigation gfIntroBottomNavigation; |
13 | 20 |
|
@@ -35,25 +42,49 @@ class _GFIntroScreenState extends State<GFIntroScreen> { |
35 | 42 | } |
36 | 43 |
|
37 | 44 | @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 | + ), |
57 | 88 | ), |
58 | 89 | ); |
59 | 90 |
|
|
0 commit comments