Skip to content

Commit 982a6ff

Browse files
committed
Backview widgets are align correctly.BackView is moved to a seperate function.
1 parent d91af05 commit 982a6ff

File tree

1 file changed

+45
-35
lines changed

1 file changed

+45
-35
lines changed

lib/stackView.dart

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -45,48 +45,58 @@ class _MainActivityState extends State<MainActivity> {
4545
return Container(
4646
child: Stack(
4747
children: <Widget>[
48-
Container(
49-
color: _theme.primaryColor,
50-
child: Center(
51-
child: Column(
52-
children: <Widget>[
53-
MaterialButton(
54-
onPressed: () => _backViewOnClick(0),
55-
child:
56-
Text("Captain America", style: TextStyle(fontSize: 30)),
57-
),
58-
MaterialButton(
59-
onPressed: () => _backViewOnClick(1),
60-
child: Text(
61-
"Iron Man",
62-
style: TextStyle(fontSize: 30),
63-
),
64-
),
65-
MaterialButton(
66-
onPressed: () => _backViewOnClick(2),
67-
child: Text(
68-
"Thor",
69-
style: TextStyle(fontSize: 30),
70-
),
71-
),
72-
MaterialButton(
73-
onPressed: () => _backViewOnClick(3),
74-
child: Text(
75-
"Hulk",
76-
style: TextStyle(fontSize: 30),
77-
),
78-
)
79-
],
80-
),
81-
),
82-
),
48+
_backView(_theme),
8349
SlideTransition(
8450
position: _getSlideAnimation(constraint), child: _frontView())
8551
],
8652
),
8753
);
8854
}
8955

56+
Widget _backView(ThemeData theme){
57+
return Scaffold(
58+
appBar: AppBar(
59+
backgroundColor: theme.backgroundColor,
60+
elevation: 0.0,
61+
),
62+
backgroundColor: theme.backgroundColor,
63+
body: Container(
64+
child: Center(
65+
child: Column(
66+
children: <Widget>[
67+
MaterialButton(
68+
onPressed: () => _backViewOnClick(0),
69+
child:
70+
Text("Captain America", style: TextStyle(fontSize: 30)),
71+
),
72+
MaterialButton(
73+
onPressed: () => _backViewOnClick(1),
74+
child: Text(
75+
"Iron Man",
76+
style: TextStyle(fontSize: 30),
77+
),
78+
),
79+
MaterialButton(
80+
onPressed: () => _backViewOnClick(2),
81+
child: Text(
82+
"Thor",
83+
style: TextStyle(fontSize: 30),
84+
),
85+
),
86+
MaterialButton(
87+
onPressed: () => _backViewOnClick(3),
88+
child: Text(
89+
"Hulk",
90+
style: TextStyle(fontSize: 30),
91+
),
92+
)
93+
],
94+
),
95+
),
96+
),
97+
);
98+
}
99+
90100
Widget _frontView() {
91101
return Scaffold(
92102
appBar: AppBar(

0 commit comments

Comments
 (0)