Skip to content

Commit 889675a

Browse files
committed
Make starter page
1 parent 2a539a0 commit 889675a

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed

lib/pages/StarterPage.dart

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:food_app/animations/FadeAnimation.dart';
3+
import 'package:food_app/pages/HomePage.dart';
4+
import 'package:page_transition/page_transition.dart';
5+
6+
class StarterPage extends StatefulWidget {
7+
@override
8+
_StarterPageState createState() => _StarterPageState();
9+
}
10+
11+
class _StarterPageState extends State<StarterPage> with TickerProviderStateMixin{
12+
AnimationController _animationController;
13+
Animation<double> _animation;
14+
15+
bool _textVisible = true;
16+
17+
@override
18+
void initState() {
19+
_animationController = AnimationController(
20+
vsync: this,
21+
duration: Duration(milliseconds: 100)
22+
);
23+
24+
_animation = Tween<double>(
25+
begin: 1.0,
26+
end: 25.0
27+
).animate(_animationController);
28+
29+
super.initState();
30+
}
31+
32+
@override
33+
void dispose() {
34+
_animationController.dispose();
35+
36+
super.dispose();
37+
}
38+
39+
void _onTap() {
40+
setState(() {
41+
_textVisible = false;
42+
});
43+
44+
_animationController.forward().then((f) =>
45+
Navigator.push(context, PageTransition(type: PageTransitionType.fade, child: HomePage()))
46+
);
47+
}
48+
49+
@override
50+
Widget build(BuildContext context) {
51+
return Scaffold(
52+
body: Container(
53+
decoration: BoxDecoration(
54+
image: DecorationImage(
55+
image: AssetImage('assets/images/starter-image.jpg'),
56+
fit: BoxFit.cover
57+
)
58+
),
59+
child: Container(
60+
decoration: BoxDecoration(
61+
gradient: LinearGradient(
62+
begin: Alignment.bottomCenter,
63+
colors: [
64+
Colors.black.withOpacity(.9),
65+
Colors.black.withOpacity(.8),
66+
Colors.black.withOpacity(.2),
67+
]
68+
)
69+
),
70+
child: Padding(
71+
padding: EdgeInsets.all(20.0),
72+
child: Column(
73+
crossAxisAlignment: CrossAxisAlignment.start,
74+
mainAxisAlignment: MainAxisAlignment.end,
75+
children: <Widget>[
76+
FadeAnimation(.5, Text('Taking Order For Faster Delivery', style: TextStyle(color: Colors.white, fontSize: 50, fontWeight: FontWeight.bold),)),
77+
SizedBox(height: 20,),
78+
FadeAnimation(1, Text("See resturants nearby by \nadding location", style: TextStyle(color: Colors.white, height: 1.4, fontSize: 18),)),
79+
SizedBox(height: 100,),
80+
FadeAnimation(1.2,
81+
ScaleTransition(
82+
scale: _animation,
83+
child: Container(
84+
decoration: BoxDecoration(
85+
borderRadius: BorderRadius.circular(10),
86+
gradient: LinearGradient(
87+
colors: [
88+
Colors.yellow,
89+
Colors.orange
90+
]
91+
)
92+
),
93+
child: AnimatedOpacity(
94+
opacity: _textVisible ? 1.0 : 0.0,
95+
duration: Duration(milliseconds: 50),
96+
child: MaterialButton(
97+
onPressed: () => _onTap(),
98+
minWidth: double.infinity,
99+
child: Text("Start", style: TextStyle(color: Colors.white),),
100+
),
101+
)
102+
)),
103+
),
104+
SizedBox(height: 30,),
105+
FadeAnimation(1.4,
106+
AnimatedOpacity(
107+
opacity: _textVisible ? 1.0 : 0.0,
108+
duration: Duration(milliseconds: 50),
109+
child: Align(
110+
child: Text("Now Deliver To Your Door 24/7", style: TextStyle(color: Colors.white70, fontSize: 15),),
111+
),
112+
)),
113+
SizedBox(height: 30,),
114+
],
115+
),
116+
),
117+
),
118+
),
119+
);
120+
}
121+
}

0 commit comments

Comments
 (0)