forked from clubgamma/Awesome-Flutter-Art
-
Notifications
You must be signed in to change notification settings - Fork 0
/
story_app_main.dart
113 lines (107 loc) 路 3.14 KB
/
story_app_main.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
import 'package:flutter/material.dart';
import 'story_brain.dart';
void main() => runApp(Destini());
class Destini extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark(),
home: StoryPage(),
);
}
}
StoryBrain storyBrain = StoryBrain();
class StoryPage extends StatefulWidget {
_StoryPageState createState() => _StoryPageState();
}
class _StoryPageState extends State<StoryPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.black12,
title: Center(
child: Text(
'Run Your Own Story !',
style: TextStyle(fontSize: 30.0, fontFamily: 'Pacifico'),
),
),
),
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("images/bg3.jpg"),
fit: BoxFit.cover,
),
),
padding: EdgeInsets.symmetric(vertical: 50.0, horizontal: 15.0),
constraints: BoxConstraints.expand(),
child: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
flex: 12,
child: Center(
child: Text(
storyBrain.getStory(),
style: TextStyle(
fontSize: 25.0,
),
),
),
),
Expanded(
flex: 2,
child: FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
),
onPressed: () {
setState(() {
storyBrain.nextStory(1);
});
//Choice 1 made by user.
},
color: Colors.red,
child: Text(
storyBrain.getChoice1(),
style: TextStyle(
fontSize: 20.0,
),
),
),
),
SizedBox(
height: 20.0,
),
Expanded(
flex: 2,
child: Visibility(
visible: storyBrain.buttonShouldBeVisible(),
child: FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
),
onPressed: () {
setState(() {
storyBrain.nextStory(2);
});
//Choice 2 made by user.
},
color: Colors.blue,
child: Text(
storyBrain.getChoice2(),
style: TextStyle(
fontSize: 20.0,
),
),
),
),
),
],
),
),
),
);
}
}