-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalert.dart
169 lines (155 loc) · 4.42 KB
/
alert.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
// inside main.dart
import 'package:flutter/material.dart';
import './home.dart';
void main(){
runApp(MaterialApp(
title: "Exploring UI Widgets",
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: Center(child: Text("UI Widgets",
style: TextStyle(
fontFamily: 'Roboto',
fontWeight: FontWeight.w700
),
textAlign: TextAlign.center,
)
),
backgroundColor: Colors.indigoAccent,
),
body: Home(),
),
));
}
// inside home.dart
import 'package:flutter/material.dart';
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Container(
padding: EdgeInsets.only(left: 10.0, top: 40.0),
alignment: Alignment.center,
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: Text(
"Spice Jet",
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 33.0,
color: Colors.blueAccent,
decoration: TextDecoration.none,
fontFamily: 'Raleway',
fontWeight: FontWeight.w600),
)),
// EdgeInsets.only(top:10.0),
Expanded(
child: Text(
"From Mumbai to New Delhi via Bangalore",
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 15.0,
color: Colors.blueAccent,
decoration: TextDecoration.none,
fontFamily: 'Raleway',
fontWeight: FontWeight.w600),
)),
],
),
Row(
children: <Widget>[
Expanded(
child: Text(
"Spice Jet",
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 33.0,
color: Colors.blueAccent,
decoration: TextDecoration.none,
fontFamily: 'Raleway',
fontWeight: FontWeight.w600),
)),
Expanded(
child: Text(
"From Jaipur to Goa",
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 15.0,
color: Colors.blueAccent,
decoration: TextDecoration.none,
fontFamily: 'Raleway',
fontWeight: FontWeight.w600),
)),
],
),
FlightImageAsset(),
FlightBookButon()
],
),
color: Colors.amberAccent,
// width:100.0,
// height: 200.0,
// margin: EdgeInsets.all(20.0),
// padding: EdgeInsets.all(20.0),
),
);
}
}
class FlightImageAsset extends StatelessWidget {
@override
Widget build(BuildContext context) {
AssetImage assetImage = AssetImage("images/tenor.gif");
Image image = Image(image: assetImage, width: 250.0);
return Container(
child: image,
padding: EdgeInsets.all(20.0),
);
}
}
class FlightBookButon extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
width: 250.0,
height: 50.0,
margin: EdgeInsets.only(top: 30.0),
child: RaisedButton(
color: Colors.deepOrange,
child: Text(
"Book your flight",
style: TextStyle(
fontFamily: "Raleway",
fontWeight: FontWeight.w700,
color: Colors.white,
fontSize: 25.0
),
),
onPressed: () {
// no action
bookFlight(context);
},
elevation: 12,
));
}
}
void bookFlight(BuildContext context)
{
var alertDialogue= AlertDialog(
title: Text(("Flight Booked Successfully"),
style: TextStyle(
fontFamily: "Raleway",
fontWeight: FontWeight.w700,
fontSize: 15.0
),
),
content: FlightImageAsset(),
);
showDialog(context: context,
builder: (BuildContext context){
return alertDialogue;
}
);
}