Skip to content

Commit 81e928c

Browse files
committed
fixed bug
1 parent f6762bf commit 81e928c

File tree

28 files changed

+451
-364
lines changed

28 files changed

+451
-364
lines changed

.flutter-plugins-dependencies

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

lib/views/account_page/state.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import 'package:flutter/material.dart';
66
import 'package:movie/globalbasestate/state.dart';
77

88
class AccountPageState implements GlobalBaseState, Cloneable<AccountPageState> {
9+
GlobalKey<ScaffoldState> scafoldState =
10+
GlobalKey<ScaffoldState>(debugLabel: 'accountPageScafold');
911
String name;
1012
String avatar;
1113
bool islogin;
@@ -25,6 +27,7 @@ class AccountPageState implements GlobalBaseState, Cloneable<AccountPageState> {
2527
..themeIndex = themeIndex
2628
..locale = locale
2729
..themeColor = themeColor
30+
..scafoldState = scafoldState
2831
..user = user;
2932
}
3033

lib/views/account_page/view.dart

Lines changed: 93 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
44
import 'package:flutter/widgets.dart';
55
import 'package:movie/actions/adapt.dart';
66
import 'package:movie/customwidgets/customcliper_path.dart';
7+
import 'package:movie/views/main_page/action.dart';
78

89
import 'action.dart';
910
import 'state.dart';
@@ -52,7 +53,7 @@ Widget buildView(
5253
width: Adapt.px(40),
5354
),
5455
SizedBox(
55-
width: Adapt.screenW() - Adapt.px(200),
56+
width: Adapt.screenW() - Adapt.px(225),
5657
child: Text(
5758
'Hi, ${state.user?.displayName ?? 'Guest'}',
5859
maxLines: 1,
@@ -67,19 +68,61 @@ Widget buildView(
6768
Expanded(
6869
child: SizedBox(),
6970
),
70-
IconButton(
71-
iconSize: Adapt.px(50),
72-
onPressed: () {
73-
if (state.islogin)
74-
dispatch(AccountPageActionCreator.onLogout());
75-
else
76-
dispatch(AccountPageActionCreator.onLogin());
77-
},
78-
icon: Icon(
79-
state.islogin ? Icons.exit_to_app : Icons.person_outline,
80-
color: Colors.white,
81-
),
82-
),
71+
state.user == null
72+
? InkWell(
73+
onTap: () => dispatch(AccountPageActionCreator.onLogin()),
74+
child: Container(
75+
height: Adapt.px(60),
76+
margin: EdgeInsets.only(
77+
right: Adapt.px(30),
78+
top: Adapt.px(13),
79+
bottom: Adapt.px(13)),
80+
padding: EdgeInsets.symmetric(
81+
horizontal: Adapt.px(20), vertical: Adapt.px(10)),
82+
decoration: BoxDecoration(
83+
borderRadius: BorderRadius.circular(Adapt.px(30)),
84+
border: Border.all(
85+
color: const Color(0xFFFFFFFF), width: 2)),
86+
child: Text(
87+
'Sign In',
88+
style: TextStyle(
89+
color: const Color(0xFFFFFFFF),
90+
fontSize: Adapt.px(26)),
91+
)))
92+
: PopupMenuButton<String>(
93+
padding: EdgeInsets.zero,
94+
offset: Offset(0, Adapt.px(100)),
95+
icon: Icon(
96+
Icons.more_vert,
97+
color: const Color(0xFFFFFFFF),
98+
size: Adapt.px(50),
99+
),
100+
onSelected: (selected) {
101+
switch (selected) {
102+
case 'Sign Out':
103+
dispatch(AccountPageActionCreator.onLogout());
104+
break;
105+
}
106+
},
107+
itemBuilder: (ctx) {
108+
return [
109+
PopupMenuItem<String>(
110+
value: 'Notifications',
111+
child: const _DropDownItem(
112+
title: 'Notifications',
113+
icon: Icons.notifications_none,
114+
),
115+
),
116+
PopupMenuItem<String>(
117+
value: 'Sign Out',
118+
child: const _DropDownItem(
119+
title: 'Sign Out',
120+
icon: Icons.exit_to_app,
121+
),
122+
),
123+
];
124+
},
125+
),
83126
SizedBox(
84127
width: Adapt.px(10),
85128
)
@@ -162,29 +205,43 @@ Widget buildView(
162205
}
163206

164207
return Scaffold(
208+
key: state.scafoldState,
209+
endDrawer: Drawer(),
165210
body: SingleChildScrollView(
166-
physics: BouncingScrollPhysics(),
167-
child: Stack(
168-
children: <Widget>[
169-
_buildBackGround(),
170-
Container(
171-
child: SafeArea(
172-
child: Column(
173-
children: <Widget>[
174-
SizedBox(
175-
height: Adapt.px(60),
176-
),
177-
_buildHeader(),
178-
SizedBox(
179-
height: Adapt.px(50),
211+
physics: BouncingScrollPhysics(),
212+
child: Stack(
213+
children: <Widget>[
214+
_buildBackGround(),
215+
Container(
216+
child: SafeArea(
217+
child: Column(
218+
children: <Widget>[
219+
SizedBox(
220+
height: Adapt.px(60),
221+
),
222+
_buildHeader(),
223+
SizedBox(
224+
height: Adapt.px(50),
225+
),
226+
_buildBody(),
227+
],
180228
),
181-
_buildBody(),
182-
],
183-
),
184-
),
185-
)
186-
],
187-
),
188-
));
229+
),
230+
)
231+
],
232+
),
233+
));
189234
});
190235
}
236+
237+
class _DropDownItem extends StatelessWidget {
238+
final String title;
239+
final IconData icon;
240+
const _DropDownItem({@required this.title, this.icon});
241+
@override
242+
Widget build(BuildContext context) {
243+
return Row(
244+
children: <Widget>[Icon(icon), SizedBox(width: 10), Text(title)],
245+
);
246+
}
247+
}

lib/views/home_page/components/header_component/view.dart

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,18 @@ Widget buildView(
3737
itemBuilder: (_, index) {
3838
final _d = _model.results[index];
3939
return _HeaderListCell(
40-
data: _model.results[index],
41-
onTap: () => dispatch(HomePageActionCreator.onCellTapped(
40+
data: _model.results[index],
41+
onTap: () => dispatch(
42+
HomePageActionCreator.onCellTapped(
4243
_d.id,
4344
_d.backdropPath,
4445
_d.title ?? _d.name,
4546
_d.posterPath,
4647
state.showHeaderMovie
4748
? MediaType.movie
48-
: MediaType.tv)));
49+
: MediaType.tv),
50+
),
51+
);
4952
})
5053
: _ShimmerHeaderList(),
5154
),
@@ -149,16 +152,17 @@ class _ShimmerHeaderList extends StatelessWidget {
149152
@override
150153
Widget build(BuildContext context) {
151154
return Shimmer.fromColors(
152-
baseColor: _baseColor,
153-
highlightColor: _highLightColor,
154-
child: ListView.separated(
155-
padding: EdgeInsets.symmetric(horizontal: Adapt.px(30)),
156-
physics: BouncingScrollPhysics(),
157-
scrollDirection: Axis.horizontal,
158-
itemCount: 4,
159-
itemBuilder: (context, index) => _ShimmerHeaderCell(),
160-
separatorBuilder: (context, index) => SizedBox(width: Adapt.px(30)),
161-
));
155+
baseColor: _baseColor,
156+
highlightColor: _highLightColor,
157+
child: ListView.separated(
158+
padding: EdgeInsets.symmetric(horizontal: Adapt.px(30)),
159+
physics: BouncingScrollPhysics(),
160+
scrollDirection: Axis.horizontal,
161+
itemCount: 4,
162+
itemBuilder: (context, index) => _ShimmerHeaderCell(),
163+
separatorBuilder: (context, index) => SizedBox(width: Adapt.px(30)),
164+
),
165+
);
162166
}
163167
}
164168

@@ -178,11 +182,14 @@ class _HeaderListCell extends StatelessWidget {
178182
width: Adapt.px(200),
179183
height: Adapt.px(280),
180184
decoration: BoxDecoration(
181-
color: Color.fromRGBO(57, 57, 57, 1),
182-
image: DecorationImage(
183-
fit: BoxFit.cover,
184-
image: CachedNetworkImageProvider(
185-
ImageUrl.getUrl(data.posterPath, ImageSize.w300)))),
185+
color: Color.fromRGBO(57, 57, 57, 1),
186+
image: DecorationImage(
187+
fit: BoxFit.cover,
188+
image: CachedNetworkImageProvider(
189+
ImageUrl.getUrl(data.posterPath, ImageSize.w300),
190+
),
191+
),
192+
),
186193
),
187194
),
188195
SizedBox(
@@ -192,10 +199,15 @@ class _HeaderListCell extends StatelessWidget {
192199
alignment: Alignment.center,
193200
width: Adapt.px(200),
194201
height: Adapt.px(70),
195-
child: Text(name,
196-
maxLines: 2,
197-
textAlign: TextAlign.center,
198-
style: TextStyle(color: Colors.grey, fontSize: Adapt.px(26))),
202+
child: Text(
203+
name,
204+
maxLines: 2,
205+
textAlign: TextAlign.center,
206+
style: TextStyle(
207+
color: Colors.grey,
208+
fontSize: Adapt.px(26),
209+
),
210+
),
199211
),
200212
],
201213
);

lib/views/home_page/components/popularposter_cpmponent/view.dart

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -209,28 +209,33 @@ class _Cell extends StatelessWidget {
209209
child: Column(
210210
children: <Widget>[
211211
Container(
212-
width: Adapt.px(250),
213-
height: Adapt.px(350),
214-
decoration: BoxDecoration(
215-
color: _theme.primaryColorDark,
216-
borderRadius: BorderRadius.circular(Adapt.px(15)),
217-
image: DecorationImage(
218-
fit: BoxFit.cover,
219-
image: CachedNetworkImageProvider(
220-
ImageUrl.getUrl(data.posterPath, ImageSize.w400))))),
221-
Container(
222-
//alignment: Alignment.bottomCenter,
223-
width: Adapt.px(250),
224-
padding: EdgeInsets.all(Adapt.px(10)),
225-
child: Text(
226-
data.title ?? data.name,
227-
maxLines: 2,
228-
//textAlign: TextAlign.center,
229-
style: TextStyle(
230-
fontSize: Adapt.px(28),
231-
fontWeight: FontWeight.bold,
212+
width: Adapt.px(250),
213+
height: Adapt.px(350),
214+
decoration: BoxDecoration(
215+
color: _theme.primaryColorDark,
216+
borderRadius: BorderRadius.circular(Adapt.px(15)),
217+
image: DecorationImage(
218+
fit: BoxFit.cover,
219+
image: CachedNetworkImageProvider(
220+
ImageUrl.getUrl(data.posterPath, ImageSize.w400),
232221
),
233-
))
222+
),
223+
),
224+
),
225+
Container(
226+
//alignment: Alignment.bottomCenter,
227+
width: Adapt.px(250),
228+
padding: EdgeInsets.all(Adapt.px(10)),
229+
child: Text(
230+
data.title ?? data.name,
231+
maxLines: 2,
232+
//textAlign: TextAlign.center,
233+
style: TextStyle(
234+
fontSize: Adapt.px(28),
235+
fontWeight: FontWeight.bold,
236+
),
237+
),
238+
)
234239
],
235240
),
236241
);

lib/views/home_page/components/share_component/view.dart

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,19 @@ class _Cell extends StatelessWidget {
201201
child: Column(
202202
children: <Widget>[
203203
Container(
204-
width: Adapt.px(250),
205-
height: Adapt.px(350),
206-
decoration: BoxDecoration(
207-
color: _theme.primaryColorDark,
208-
borderRadius: BorderRadius.circular(Adapt.px(15)),
209-
image: DecorationImage(
210-
fit: BoxFit.cover,
211-
image: CachedNetworkImageProvider(
212-
ImageUrl.getUrl(data.photourl, ImageSize.w400))))),
204+
width: Adapt.px(250),
205+
height: Adapt.px(350),
206+
decoration: BoxDecoration(
207+
color: _theme.primaryColorDark,
208+
borderRadius: BorderRadius.circular(Adapt.px(15)),
209+
image: DecorationImage(
210+
fit: BoxFit.cover,
211+
image: CachedNetworkImageProvider(
212+
ImageUrl.getUrl(data.photourl, ImageSize.w400),
213+
),
214+
),
215+
),
216+
),
213217
Container(
214218
//alignment: Alignment.bottomCenter,
215219
width: Adapt.px(250),

0 commit comments

Comments
 (0)